Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sql ÎÊÌâ - Oracle / ¿ª·¢

Select * from UserInfo where uif_UserCode in (1,12) 
ÓÃinÔÚÊý¾ÝÁ¿´óµÄʱºòЧÂʲ»¸ß£¬(1ºÍ12ÊÇ´«¹ýÀ´µÄÖµ)³ýÁËÕâÖÖ·½·¨»¹¿ÉÒÔÔõôд£¬
ÓÐÈË˵ÓÃexists µ½µ×ÒªÔõÃ´Ð´ÄØ ?
ÁбíÖµ²»¶à£¬ÓÃinÐÔÄÜҲɶ´ó²»Á˵Ä
ÆäʵÁбíÏî²»¶à£¬in ºÍexists²î±ðºÜС
Èç¹ûÒªÓÃexists±ØÐë´æÔÚÁíÒ»¸ö±íÖУ¬uif_UserCodeÉϽ¨Á¢Ë÷Òý¡£
Select * from UserInfo a where exists( select 1 from tempUserInfo b where a.uif_UserCode =b.uif_UserCode )

ÒýÓÃ
Select * from UserInfo where uif_UserCode in (1,12)
ÓÃinÔÚÊý¾ÝÁ¿´óµÄʱºòЧÂʲ»¸ß£¬(1ºÍ12ÊÇ´«¹ýÀ´µÄÖµ)³ýÁËÕâÖÖ·½·¨»¹¿ÉÒÔÔõôд£¬
ÓÐÈË˵ÓÃexists µ½µ×ÒªÔõÃ´Ð´ÄØ ?


in µÄ»°Ö»Òª·¶Î§²»´ó¸úexists¹Ø¼ü×ֲ¶à 

ÒªÊÇ·¶Î§´óµÄ»° ¿ÉÒÔ¿¼ÂÇexists,¿ÉÒÔ½¨Ë÷Òý°É
Select * from UserInfo a where exists(select 1 from UserInfo where a.UserCode=UserCode)

Select * from UserInfo where uif_UserCode in (1,12) 

¸Ä³É
Select * from UserInfo where uif_UserCode=1 or uif_UserCode=12

Íü¼ÇÄĸöЧÂʸßÁË£¬ºÇºÇ£¬ÄãÊÔÊÔ

ÒýÓÃ

Select * from UserInfo where uif_UserCode in (1,12)

¸Ä³É
Select * from UserInfo where uif_UserCode=1 or uif_UserCode=12

Íü¼ÇÄĸöЧÂʸßÁË£¬ºÇºÇ£¬ÄãÊÔÊÔ


´«µÄ1ºÍ12²»Êǹ̶¨µÄ£¬ÓпÉÄÜ»¹»áÊÇ3¸öÊý»òÕ߸ü¶àÄØ£¿

Èç¹û²»ÓÃexists»¹ÓÐʲô¸üºÃµÄ·½·¨Âð£¿

Select * from UserInfo where uif_UserCode=1 or uif_UserCode=12


Ïà¹ØÎÊ´ð£º

sqlССµÄÒÉÎÊ - .NET¼¼Êõ / C#

¿ÉÄÜÒòΪ¹¤×÷µÄÔ­Òò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......

ÇóÒ»¸öSQLÓï¾ä - MS-SQL Server / »ù´¡Àà

×Ö¶Î1,×Ö¶Î2.....×Ö¶ÎN,Status,ParentID
1,Name1....test1,1,99
1,Name1....test1,3,99
1,Name2....test2,1,101
1,Name2....test2,3,101
1,Name3....test3,2,101
1,Name1....test1,4,101
ÏëÒªµÄ½á¹ûÊÇ:
1,Na ......

sql ÎÊÌâ - MS-SQL Server / »ù´¡Àà

ÐèÇóÈçÏ£º
ѧԺ academy£¨aid,aname£©
°à¼¶ class£¨cid,cname,aid£©
ѧÉú stu(sid,sname,aid,cid)
סËÞÇø region(rid,rname)
ËÞÉáÂ¥ build(bid,rid,bnote) bnoteÊÇ¡®ÄС¯/¡®Å®¡¯
ËÞÉá dorm(did,rid,bid£¬bedn ......

SQL·ÖÒ³ÓëOracle·ÖÒ³µÄÒÉÎÊ£¿ - Java / Web ¿ª·¢

ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ãæ£¬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ