Ò»¸ö¶à±íǶÌײéѯµÄsqlÓï¾ä
select batch_no "Åú´ÎºÅ",get_id "·ÖÀà" from (
select(
select plan1.batch_no from product_plan plan1 where plan1.item_no=(select head1.product_code from wo_head head1 where head1.order_no =bbb)) batch_no,
(select decode(get_id,'BUY','Í⹺¼þ','MAK','×ÔÖƼþ','MB','䶨') from item where item_no= aaa) get_id
from (select req.item_no aaa,req.order_no bbb from process_req req where req.status_id='C'and req.order_no in(select head.order_no from wo_head head where head.batch_no in (select batch_no from product_plan) or head.product_code in ( select item_no from product_plan )))) order by qty desc
Ïà¹ØÎĵµ£º
ÏÖÏó:
ÓÃVS 2008´ò¿ªVS 2005¿ª·¢µÄ±¨±íºó,»á°Ñ±¨±íµ¥ÏòÉý¼¶µ½2008µÄshcema,²»ÄÜÔÙת»Ø2005µÄschema.ÔÙ·¢²¼µ½SQL Server 2005ÉÏʱ»á±¨´í:"ÎÞ·¨Éý¼¶µÄÃû³Æ¿Õ¼ä".
ÕÒµ½µÄ½â¾ö°ì·¨:
ÔÚSQL Server 2005ËùÔڵĻúÆ÷ÉÏ¿ª·¢±¨±í.
°ÑSQL ServerÉý¼¶µ½ SQL Server 2008.
¾Ý˵ÓÐReporting Service 2008µÄµ¥¶À°²×°°æ,¿ÉÒÔ ......
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃǴ󲿷ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡
¡¡¡¡ÔÚÕâƪÎÄÕÂÀÎÒ½«¸æËßÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄã ......
SQL ÖеÄÖ÷¼üµÄ×÷ÓÃ:
Äܹ»Î¨Ò»±íʾÊý¾Ý±íÖеÄÿ¸ö¼Ç¼µÄ¡¾×ֶΡ¿»òÕß¡¾×ֶΡ¿µÄ×éºÏ¾Í³ÆΪÖ÷Âë(Ö÷¼ü)¡£
×÷ÓÃ
1¡¢Ö÷¼üΨһµÄʶ±ðÿһ¼Ç¼;
2¡¢Ö÷¼ü½«¼Ç¼ºÍ´æ·ÅÔÚÆäËû±íÖеÄÊý¾Ý½øÐйØÁª¡£ÔÚÕâÒ»µãÉÏ£¬Ö÷¼üÊDz»Í¬±íÖи÷¼Ç¼֮¼äµÄ¼òµ¥Ö¸Õë¡£
ÈôÓÐÁ½¸ö±íA£¬B£¬keyÊÇAµÄÖ÷¼ü£¬¶øBÖÐÒ²ÓÐkey×ֶΣ¬Ôòkey¾ÍÊDZíBµÄÍâ¼ü¡£
A ......
ÔÚSQL Server 2005Êý¾Ý¿âÖÐʵÏÖ×Ô¶¯±¸·ÝµÄ¾ßÌå²½Öè:
1¡¢´ò¿ªSQL Server Management Studio
2¡¢Æô¶¯SQL Server´úÀí
3¡¢µã»÷×÷Òµ->н¨×÷Òµ
4¡¢"³£¹æ"ÖÐÊäÈë×÷ÒµµÄÃû³Æ
5¡¢Ð½¨²½Ö裬ÀàÐÍÑ¡T-SQL£¬ÔÚÏÂÃæµÄÃüÁîÖÐÊäÈëÏÂÃæÓï¾ä£¨ºìÉ«²¿·ÖÒª¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿ö¸ü¸Ä£¬'D:\LMS2.0\LMS2.0\bak\' ¸ÄΪ×Ô¼ºµÄ±¸·Ý·¾¶£¬ ......
ΪÁË´ó¼Ò¸üÈÝÒ×Àí½âÎÒ¾Ù³öµÄSQLÓï¾ä£¬±¾Îļٶ¨ÒѾ½¨Á¢ÁËÒ»¸öѧÉú³É¼¨¹ÜÀíÊý¾Ý¿â£¬È«ÎľùÒÔѧÉú³É¼¨µÄ¹ÜÀíΪÀýÀ´ÃèÊö¡£
¡¡¡¡1.ÔÚ²éѯ½á¹ûÖÐÏÔʾÁÐÃû£º
¡¡¡¡a.ÓÃas¹Ø¼ü×Ö£ºselect name as 'ÐÕÃû' from students order by age
¡¡¡¡b.Ö±½Ó±íʾ£ºselect name 'ÐÕÃû' from students order by age
¡¡¡¡2.¾«È·²éÕÒ:
¡¡¡¡a.Ó ......