¡¶Èí¼þ¿ª·¢ÐÔÄÜÓÅ»¯ÏµÁС·Ö®SqlÐÔÄÜÓÅ»¯(¶þ)
Ò»¡¢SQLƴд½¨Òé 1¡¢²éѯʱ²»·µ»Ø²»ÐèÒªµÄÐС¢ÁÐ ÒµÎñ´úÂëÒª¸ù¾Ýʵ¼ÊÇé¿ö¾¡Á¿¼õÉÙ¶Ô±íµÄ·ÃÎÊÐÐÊý£¬×îС»¯½á¹û¼¯£¬ÔÚ²éѯʱ£¬²»Òª¹ý¶àµØʹÓÃͨÅä·ûÈ磺select * from table1Óï¾ä£¬ÒªÓõ½¼¸ÁоÍÑ¡Ôñ¼¸ÁУ¬È磺select col1,col2 from table1;ÔÚ¿ÉÄܵÄÇé¿öϾ¡Á¿ÏÞÖƽá¹û¼¯ÐÐÊýÈ磺select top 100 col1,col2,col3 from talbe2,ÒòΪijЩÇé¿öÏÂÓû§ÊDz»ÐèÒªÄÇô¶àµÄÊý¾ÝµÄ¡£ 2¡¢ºÏÀíʹÓÃEXISTS, NOT EXISTS×Ö¾ä ÈçÏÂËùʾ£º SELECT SUM(T1.C1) from T1 WHERE ((SELECT COUNT(*) from T2 WHERE T2.C2=T1.C2)>0) SELECT SUM(T1.C1) from T1 WHERE EXISTS(SELECT * from T2 WHERE T2.C2=T1.C2) Á½ÖÖ²úÉúÏàͬµÄ½á¹û£¬µ«ÊǺóÕßµÄЧÂÊÏÔȻҪ¸ß¹ýÓÚÇ°Õß¡£ÒøÐкóÕß²»»á²úÉú´óÁ¿Ëø¶¨µÄ±íɨÃè»òÊÇË÷ÒýɨÃè¡£ ¾³£ÐèҪЩһ¸öT_SQLLÓï¾ä±È½ÏÒ»¸ö¸¸½á¹û¼¯ºÍ×Ó½á¹û¼¯£¬´Ó¶øÕÒµ½ÊÇ·ñ´æÔÚÔÚ¸¸½á¹û¼¯ÖÐÓжøÔÚ×Ó½á¹û¼¯ÖÐØ¿嘢µÄ¼Ç¼£¬È磺 SELECT _a.hdr_key from hdr_tb1 a -----------tb1 a ±íʾtb1ÓñðÃûa´úÌæ WHERE NOT EXISTS (SELECT * from dt1_tb1 b WHERE a.hdr_key = b.hdr_key) SELECT _a.hdr_key from hdr_tb1 a -----------tb1 a ±íʾtb1ÓñðÃûa´úÌæ LEFT JION dt1_tb1 b ON a.hdr_key = b.hdr_key WHERE b.hdr_key IS NULL SELECT hdr_key from hdr_tb1 WHERE hdr_key NOT IN (SELECT hdr_key from dt1_tb1) ÈýÖÖд·¨¶¼¿ÉÒԵõ½Í¬ÑùµÄ½á¹û¼¯£¬µ«ÊÇЧÂÊÊÇÒÀ´Î½µµÍ 3¡¢³ä·ÖÀûÓÃÁ¬½ÓÌõ¼þ ÔÚijÖÖÇé¿öÏ£¬Á½¸ö±íÖ®¼ä¿ÉÄܲ»Ö¹Ò»¸öµÄÁ¬½ÓÌõ¼þ£¬ÕâʱÔÚwhere ×Ö¾äÖн«Á½âÌõ¼þÍêÕûµÄдÉÏ£¬ÓпÉÄÜ´ó´óÌá¸ß²éѯËٶȡ£ Àý£º a)¡¢SELECT SUM(A.AMOUNT) from ACCOUNT A left j
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
ÔÚÈëÃÅƪ£¬ÎÒÃÇѧ»áÁˣӣѣÌ×¢ÈëµÄÅжϷ½·¨£¬µ«ÕæÕýÒªÄõ½ÍøÕ¾µÄ±£ÃÜÄÚÈÝ£¬ÊÇÔ¶Ô¶²»¹»µÄ¡£½ÓÏÂÀ´£¬ÎÒÃǾͼÌÐøѧϰÈçºÎ´ÓÊý¾Ý¿âÖлñÈ¡ÏëÒª»ñµÃµÄÄÚÈÝ£¬Ê×ÏÈ£¬ÎÒÃÇÏÈ¿´¿´£Ó£Ñ£Ì×¢ÈëµÄÒ»°ã²½Ö裺
µÚÒ»½Ú¡¢£Ó£Ñ£Ì×¢ÈëµÄÒ»°ã²½Öè
¡¡¡¡Ê×ÏÈ£¬Åжϻ·¾³£¬Ñ°ÕÒ×¢Èëµã£¬ÅжÏÊý¾Ý¿âÀàÐÍ£¬ÕâÔÚÈëÃÅƪÒѾ½²¹ýÁË¡£
¡¡¡¡Æä´Î£¬¸ù¾Ý×¢Èë ......
Æô¶¯SQL Server (SQLEXPRESS)·þÎñʱÌáʾ´íÎó£¬Ê¼þ²é¿´Æ÷ÏÔʾÒÔÏÂÐÅÏ¢£¨ID 9003£©£º
´«µÝ¸øÊý¾Ý¿â 'master' ÖеÄÈÕ־ɨÃè²Ù×÷µÄÈÕ־ɨÃèºÅ (276:232:1) ÎÞЧ¡£´Ë´íÎó¿ÉÄÜָʾÊý¾ÝË𻵣¬»òÕßÈÕÖ¾Îļþ(.ldf)ÓëÊý¾ÝÎļþ(.mdf)²»Æ¥Åä¡£Èç¹û´Ë´íÎóÊÇÔÚ¸´ÖÆÆÚ¼ä³öÏֵģ¬ÇëÖØд´½¨·¢²¼¡£·ñÔò£¬Èç¹û¸ÃÎÊÌâµ¼ÖÂÆô¶¯ÆÚ¼ä³ö´í£¬Çë´Ó± ......
À´Ô´:http://hi.baidu.com/czgblog/blog/item/3abd5aa911d51ff51f17a292.html
function OnFirstUIAfter()
STRING szTitle, szMsg1, szMsg2, szOpt1, szOpt2;
NUMBER bvOpt1, bvOpt2;
NUMBER bShowUpdateServiceDlg;
......
1.²éѯµÄÄ£ºýÆ¥Åä
¾¡Á¿±ÜÃâÔÚÒ»¸ö¸´ÔÓ²éѯÀïÃæʹÓà LIKE '%parm1%'—— ºìÉ«±êʶλÖõİٷֺŻᵼÖÂÏà¹ØÁеÄË÷ÒýÎÞ·¨Ê¹Óã¬×îºÃ²»ÒªÓÃ.
½â¾ö°ì·¨:
ÆäʵֻÐèÒª¶Ô¸Ã½Å±¾ÂÔ×ö¸Ä½ø£¬²éѯËٶȱã»áÌá¸ß½ü°Ù±¶¡£¸Ä½ø·½·¨ÈçÏ£º
a¡¢ÐÞ¸Äǰ̨³ÌÐò——°Ñ²éѯÌõ¼þµÄ¹©Ó¦ÉÌÃû³ÆÒ»À¸ÓÉÔÀ´µÄÎı¾ÊäÈë¸ÄΪÏÂÀÁб ......