¡¾»ã×Ü¡¿SQL CODE ¾µä·¾«²Ê
¡¾»ã×Ü¡¿SQL CODE --- ¾µä·¾«²Ê
Êý¾Ý²Ù×÷Àà SQLHelper.cs
ÎÞÏÞ¼¶·ÖÀà ´æ´¢¹ý³Ì
°ÙÍò¼¶·ÖÒ³´æ´¢
SQL¾µä¶ÌС´úÂëÊÕ¼¯
ѧÉú±í ¿Î³Ì±í ³É¼¨±í ½Ìʦ±í 50¸ö³£ÓÃsqlÓï¾ä
SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
Óαê
¸ù¾Ý²»Í¬µÄÌõ¼þ²éѯ²»Í¬µÄ±í
INNER JOIN Óï·¨
master.dbo.spt_values µÄÃîÓÃ
¹ØÓÚSQLʱ¼äÀàÐ͵ÄÄ£ºý²éѯ
ÅÅÃû sql
ͬ²½Á½¸öÊý¾Ý¿â
QLServerºÍOracle³£Óú¯Êý¶Ô±È
¹úÄÚ×îÐÂ×îÈ«ÃæIPÊý¾Ý¿â
sql ÏȽøÏȳö ¿â´æ
BOM ´´½¨Óû§¶¨Ò庯Êý,ÿ¸ö×Ó½Úµãde¸¸½ÚµãµÄÐÅÏ¢
ÓÃPARSENAMEº¯Êý²ð·Ö×Ö·û´®
½«Ò»¸ö×Ö·û´®·Ö³É¶àÁÐ
×Ö·û´®·Ö¸îº¯Êý--²ð·Ö³É¶àÐÐ
ºÏ²¢¶àÐеÄijһÁÐÖµ
ÁкÍÏà¼õ L3-L2
ͳ¼Æ½»²æÏàµÈÁ½ÁÐÔª×æµÄ´ÎÊý È¥µôÖØ¸´
ÐÐÁРת»» ºÏ²¢ ·Ö²ð
SQL ÄêÁä¶Î ·Ö×éͳ¼Æ
ÿ¸ö·ÖÀàÈ¡×îеļ¸ÌõµÄSQLʵÏÖ
С¼Æ ºÏ¼Æ -ͳ¼Æ
ÇóÿÌìµÄÊÕÈëºÍÖ§³ö
Óû§Ïû·Ñ×ܽð¶î 2000ÒÔÏ 2000-4000 4000-6000
ÓÐСʱ¡¢·ÖÖÓ£¬Ç󯽾ù¹¤×÷ʱ¼ä
µç»°Í¨»°´ÎÊýÒÔ¼°Ê±³¤
ʱ¼äÌìÊýÏà²î5ÌìÒÔÉϲ¢ÇҼǼÌõÊý´óÓÚ2µÄÐÅÏ¢
ͳ¼ÆÎÄÕ¸÷ÖÖ·ÖÀà×ÜÊý
½üÆÚ¼Û¸ñ´¦ÓÚ½µ¼ÛÇ÷ÊÆ£¨ÖÁÉÙµ÷ÁË3´Î£©µÄËùÓÐÉÌÆ·
°à¼¶¿¼ÊÔÈËÊý´óÓÚ10¡¢°à¼¶×îµÍ·ÖÔÚ50·ÖÒÔÉÏ¡¢¼ÆËã»úѧԺ¡¢°à¼¶Æ½¾ù·Ö´Ó¸ßµ½µÍǰ10Ãû
È¡³öµã»÷Á¿×î¸ßµÄÎÄÕÂ100ƪ£¬Ã¿¸ö×÷Õß²»³¬¹ý5ƪ
ÈçºÎÏòÒ»¸ö×ÔÔö×ֶβåÖµ
²é×Ö¶ÎÖ¸¶¨Êý¾ÝºóÒ»ÐмǼ
ÕÒ³öÓëijidÏà½üµÄËÄÌõ¼Ç¼
Í£Ö¹Êý¾Ý¿âµÄÓû§Á¬½Ó
½â¾ö²¢Çå³ýSQL±»×¢Èë<script>¶ñÒⲡ¶¾´úÂëµÄÓï¾ä
http://www.cnblogs.com/zengxiangzhan/archive/2010/05/12/1733758.html
http://topic.csdn.net/u/20100512/17/1a5fb051-6c38-495e-955d-6a040cf74662.html
Ïà¹ØÎĵµ£º
1. GROUP BY ÊÇ·Ö×é²éѯ, Ò»°ã GROUP BY ÊǺ;ۺϺ¯ÊýÅäºÏʹÓÃ
group by ÓÐÒ»¸öÔÔò,¾ÍÊÇ select ºóÃæµÄËùÓÐÁÐÖÐ,ûÓÐʹÓþۺϺ¯ÊýµÄÁÐ,±ØÐë³öÏÖÔÚ group by ºóÃæ£¨ÖØÒª£©
ÀýÈç,ÓÐÈçÏÂÊý¾Ý¿â±í£º
A B
1 abc
1 bcd
1 asdfg
Èç¹ûÓÐÈ ......
oracleµÄodbcÍø¹Ø£¨gateway£©¼¸ºõÌṩһ¸öÎÞÏßµÄÊý¾ÝÕûºÏƽ̨£¬ÔÚoracleºÍÆäËüRDBMSÖ®¼ä£¬ÎÒÔÚÕâ²»Ïë˵ËüµÄ£¬²Ù×÷£¬ÏÞÖÆÒÔ¼°Ïà¹ØÐÔ£¬Ëü½â¾öÁËÒ»¸öСÎÊÌ⣬°ÑËü½¨Á¢ÆðÀ´ÄãÄÜ£¬ÀýÈ磬´´½¨Ò»¸ö database link ÔÚoracle ºÍoracleÖ®¼ä£¬±Ï¾¹£¬ÕâÑù²»ÊǺܺÃô£¬ÀýÈçÄãÄÜÔËÐÐÏÂÃæµÄsqlÓï¾ä£¬
select o.col1, m.col1 from or ......
SqlÓï¾ä×÷Ϊ¹ú¼Ê±ê×¼µÄÊý¾Ý¿â²éѯÓï¾ä£¬±±¾©°á¼Ò¹«Ë¾ ±±¾©Êèͨ¹«Ë¾ÔÚ¸÷ÖÖ±à³Ì»·¾³Öеõ½Á˹㷺µÄÓ¦Óá£×÷Ϊһ¸ö³ÉÊì¡¢Îȶ¨µÄϵͳ£¬Óû§µÇ½ºÍÃÜÂëÑéÖ¤ÊDZز»¿ÉÉٵġ£ÔÚÆ½Ê±µÄ±à³Ì¹¤×÷ÖÐÐí¶à³ÌÐòÔ±ÔÚÓÃsqlÓï¾ä½øÐÐÓû§ÃÜÂëÑé֤ʱÊÇͨ¹ýÒ»¸öÀàËÆÕâÑùµÄÓï¾äÀ´ÊµÏֵģº
strSel = " Select * from Óû§±í where ÐÕÃû= '" ......
´ò¿ª²éѯ·ÖÎöÆ÷£¬ÔÚ²éѯ·ÖÎöÆ÷ÏÂÖ´ÐУº
exec sp_defaultdb Õ˺ÅÃû , ĬÈÏÊý¾Ý¿â
¾ÙÀý£ºÎÒµÄĬÈÏÕ˺ÅÊÇsa£¬´ò¿ª²éѯ·ÖÎöÆ÷£¬Ä¬ÈÏÊý¾Ý¿âÊÇmaster£»ÏÖÔÚÎÒн¨ÁËÒ»¸öÊý¾Ý¿âmyData,Ï뽫ĬÈÏÊý¾Ý¿â¸ÄΪmyData£¬Ö»ÐèÖ´ÐУº exec sp_defaultdb sa , myData ¼´ ......
SQL Server 2005
±¾Æª½éÉÜÈçºÎÁ´½Óµ½Sql Server 2005.
²ÉÓÃSQL ±¾µØ¿Í»§ ODBCÇý¶¯
²ÉÓÃSqlÉí·ÝÑéÖ¤
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
ÄãÕýÔÚʹÓÃSQL Server 2005 Express£¿±ðÍü¼ÇÁË£¬ServernameµÄÓï·¨ÊÇServername\SQLEXPRESS£¬Äã¿ÉÒÔÓÃÄã°²× ......