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

ÇóÒ»sql¡¾Ð»Ð»¡¿ - MS-SQL Server / »ù´¡Àà

ÐèÇóÈçÏ£º
a±í:
 p_id status  
  1 0
  2 0

b±í
rec_id pid purchase_qty receive_qty flag
1 1 10 10 0
2 1 1000 1000 0
3 2 25 10 1
4 2 25 25 0
ÏëµÃµ½ÈçϵĽá¹û£º
1.Èç¹ûb±íÖеÄpurchase_qty=receive_qty,ÇÒb±íÖеÄpid¹ØÁªa±íÖеÄp_id,µ±a±íÖÐËùÓÐÔÚb±íÖеÄpid=1ÇÒpurchase_qtyÓëreceive_qtyÏàͬʱ£¬¸üÐÂa±íÖеÄstatusΪ1
2.Èç¹ûB±íÖеÄflagΪ1µÄ»°£¬±íʾÕâÌõ¼Ç¼ҲÍê³ÉÁË£¬²»ÐèÒª¿¼ÂÇpurchase_qty=receive_qtyÕâÑùµÄÌõ¼þ£¬Ò²½«a±íÖеÄstatus¸üÐÂΪ1

лл´ó¼ÒÀÖ



 
Õâô¿ì¾Í³ÁÁË£¬up

SQL code:

update @ta
set status=1
from @ta a,@tb b
where a.p_id=b.pid
and (purchase_qty=receive_qty or flag=1)
??

SQL code:
update a±í A set status=1 where
exists(select 1 from b±í where A.pid=pid and (purchase_qty=receive_qty or flag=1))


??

SQL code:
update a set status = case when
b.purchase_qty = b.receive_qty and b.pid = 1


Ïà¹ØÎÊ´ð£º

csvÎļþת»»³Ésqlµ¼Èëµ½Êý¾Ý¿â£¬Ã»ÓÐÊý¾ÝΪºÎ£¿

Ö´ÐеÄ˳Ðò£º
1£©Îļþä¯ÀÀ¿ò£¨Ñ¡ÔñÎļþʹÓã©
Ñ¡ÔñºÃÎļþºó
µã»÷Ò»¸öµ¼Èë°´Å¥µÄʱºò £¬°ÑÉÏÃæÉÏ´«¿òÀïµÄcsvÎļþÒÔÒ»¸öIDΪÎļþÃû£¬ÉÏ´«µ½**/**Îļþ¼ÐÏÂ
2£©¶ÁÈ¡Õâ¸öÎļþ¼ÐϵÄcsvµÄÎļþ£¬×ª»»³Ésql
3 ......

Êý¾Ý´°¿Ú¶¯Ì¬ÐÞ¸ÄSql - PowerBuilder / DataWindow

ΪÁËÂú×ãÊý¾Ý²éѯµÄËÙ¶ÈÎÊÌ⣬ÎÒ½«Ò»ÕÅÊý¾ÝÁ¿´óµÄѧÉú±í°´Äê¶È·Ö³É¶à¸ö±í
students_2008, students_2009È»ºóÎÒÓÖ×öÁËÒ»¸öÄ£°å±ístudents_template,Ä£°å±íÖеÄ×ֶκÍstudents_2008, students_2009Ò»Ñù£¬Ö»²»¹ýÊÇÒ»¸ö ......

pl/SqlÈçºÎ²éѯ×Ö·û´®°üÀ¨%

pl/SqlÈçºÎ²éѯ×Ö·û´®°üÀ¨%, 
ÀýÈç:TABLE a
columnA
'222'
'33%44'
ÈçºÎ²éѯ±íaÖÐcolumnA×Ö¶ÎÖÐÄÄЩÐаüº¬'%'
лл
select * from a
where columna like '%/%%' escape '/'

UP

SELECT * from a ......

sql º¯ÊýÎÊÌâ - MS-SQL Server / Ó¦ÓÃʵÀý

sqlÎÒÏëµÃµ½Ò»×Ö·û´®Îª:
sldkf|||sdeww
erkv|||rltdk
jemcl|||ligf
¾ÍÊÇ|||ºóÃæµÄ×Ö·ûÓÐʲôº¯ÊýÄܵõ½Âð£¿ÊÇÔÚsqlÓï¾äдµÄ£¬²»ÊÇÔÚÒ³ÃæдµÄ£¬ÄÇλ¸ßÊÖÀ´Ö¸½ÌÏ£¬ÐÂÊÖ£¬Ð»Ð»
ÔνñÌì²»ÊÇдÁËô

select parsen ......

ÇóÒ»¸öSQLµÃ²éѯÓï¾ä

ÒÑÖªÒ»¸ö¹©Ó¦Çé¿ö±í SPJ
ÓÐÊôÐÔ ¹©Ó¦É̺ÅÂë SNO
  Áã¼þºÅÂë PNO
  ¹¤³ÌÏîÄ¿ºÅÂë JNO
  Áã¼þÊýÁ¿ QTY
ÇóÂú×ãÏÂÃæÒªÇóµÄ¹©Ó¦É̺ÅÂ룬¸Ã¹©Ó¦É̹©Ó¦¸øij¸ö¹¤³ÌÁã¼þP1 µÄÊýÁ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ