ÐÂÊÖµÄSQL²éѯÎÊÌâ
±íÖеÄÒ»¸öÊôÐÔÁÐchoiceÓÐÁ½ÖÖ¿ÉÄܵÄÖµ£ºstringA,stringB£¬¶¼ÊÇ×Ö·û´®¡£
ÎÒÓÃÒ»¸öresult(stringÀàÐÍ£©´æ´¢Ñ¡ÔñµÄ½á¹û
SELECT * from tablename WHERE choice = result;
ÏÖÔÚÔÚÑ¡ÔñµÄʱºò£¬Òª¶à´¦ÀíÒ»¸ö "²»ÏÞ" µÄÇé¿ö£¬ÕâʱµÄ²éѯÓï¾äÓ¦¸ÃÔõôдµÄ£¿
ʲô½Ð×ö¡°²»ÏÞ¡±µÄÇé¿ö
SQL code:
SELECT * from tablename WHERE choice =stringA or choice =stringB
?
SQL code:
SELECT * from tablename WHERE CHARINDEX(','+choice +',', ','+result+',')>0;
??
²Î¿¼Ò»ÏÂÕâ¸ö£º
http://blog.csdn.net/sdhdy/archive/2009/07/21/4366340.aspx
WHERE ºóÃæµÄÑ¡ÔñÌõ¼þ²»Ö¹Ò»¸ö£¬Èç¹ûÑ¡ÔñÁË ²»ÏÞ£¬ÔòºöÂÔchoice = resultÕâһѡÔñÌõ¼þ¡£
SQL code:
if Ñ¡ÔñÁË ²»ÏÞ
SELECT * from tablename
else
SELECT * from tablename WHERE choice = result
....
SELECT * from tablename WHERE 1=1 and case choice when '²»ÏÞ' then choice else result end
ÄãµÄÕâ¸öresultÓ¦¸ÃÊǸö²ÎÊý°É ÄãÖ»ÐèÒªÔÚ²»ÏÞµÄʱºò¸ø
Ïà¹ØÎÊ´ð£º
±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½Ãæȥѧϰ
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......
×îÏÈϵͳװÓÐsql2000£¬ÀïÃæÒ²ÔËÐÐÁ˺öàÍøÕ¾Êý¾Ý¿âÓ¦ÓóÌÐò£¬ÏÖÔÚÓиöÍøÕ¾ÐèÒªÅÜÔÚsql server2005ƽ̨ÉÏ£¬ÇëÎÊÎÒ¿ÉÒÔÖ±½ÓÔÚÕâ¸ö°²×°ÓÐsql server2000µÄ·þÎñÆ÷ÉÏÖ±½Ó°²×°sql server2005Â𣿻᲻»áÁ½¸ö°æ±¾µÄ·¢Éú¼æÈÝÐ ......
±íA
¿¨ºÅ ʱ¼ä
1 null
2 null
3   ......
ÎÒµÄÓï¾äΪstr1.Format("UPDATE wz set title='%s',class='%s',nr='%s' WHERE title=m_xb1",
m_bt, strTemp, fromClipboard);
ÆäÖÐCString m_xb1;±£´æµÄÖµ£¬µ«ÊÇÕâ¸öÓï ......