sql ±¯¾ç
http://topic.csdn.net/u/20091008/12/a2577eba-1b5b-4e1e-ab20-0a047bf3f8d7.html?4385
1Â¥
liangCK
SQL code:
update a set
ʱ¼ä = b.ʱ¼ä
from tb1 as a
join tb2 as b
on a.¿¨ºÅ= b.¿¨ºÅ
where not exists(select * from tb2
where ¿¨ºÅ=b.¿¨ºÅ and ʱ¼ä> b.ʱ¼ä)
3Â¥
liangCK
SQL code:
update a set
ʱ¼ä = b.ʱ¼ä
from @tb1 as a
join @tb2 as b
on a.¿¨ºÅ= b.¿¨ºÅ
where not exists(select * from @tb2
where ¿¨ºÅ=b.¿¨ºÅ and ʱ¼ä< b.ʱ¼ä)
µ±Ê±ÎÒûÓп´µ½3Â¥µÄÕý½â£¬ÓÚÊǾͷ¢ÁËÒ»¸öÌû×Ó
http://topic.csdn.net/u/20091008/13/490b3e82-3e4c-4e7d-a5a1-a2632e355bd8.html?32712
¿´À´ wufeng4552 xuejie09242 navy887
¶¼Ã»Óп´µ½ Ìû×ÓÖеĴíÎó°¡
b ÄÚ±í
1 2007 1 2007
1 2008 1 2008
1 2004 1 2004
2007 = <all N
2008 = <all n
2004 = <all n
Ó¦¸ÃÊǰѱÈ×îСµÄ¶¼Åųýµô
±ÈÈç
2007>(2007 2008 2004) y
2008>(2007 2008 2004)
Ïà¹ØÎÊ´ð£º
СµÜÊǸöÐÂÊÖ ÏÖÔÚÓиöÎÊÌâÒ»Ö±²»Äܽâ¾ö
ÀýÈç
procedure produce_proc
@p001 nvarchar(8000),
@p002 nvarchar(8000),
@p003 nvarchar(8000),
& ......
дSQLÓï¾ä£º
±í1£ºCLASS
º¬ÓÐÁ½¸ö×ֶΣºID£¬CLASSNAME,±í½á¹¹ÈçÏ£º
ID CLASSNAME
1 A
2 B
3 C
4 D
±í2£ºSTUDENT
º¬ÓÐÈçÏÂ×ֶΣºS ......
BeginTime BtsId Total68PhyRCENum
2009-9-30 0:00 1 192
2009-10-1 0:00 1 192
2009-10-2 0:00 1 192
2009-10-3 0:00 1 192
2009-10-4 0:00 1 256
2009-10-5 0:00 1 256
2009-10-6 0:0 ......
ÓÐÒ»¸ö±í½á¹¹ÈçÏ£º
ÎïÆ·±àÂë ʹÓôÎÊý Ãû³Æ ÊôÐÔ1£¬ÊôÐÔ2.¡£¡£¡£¡£¡£¡£
ÆäÖУ¬Ç°Á½ÏîΪÖ÷¼ü£¨ÎïÆ·±àÂë ʹÓôÎÊý£©£¬´ÎÊý×î¶àΪ5
ÏÖÔÚÎÒÏë°Ñ ͬһÖÖÎïÆ·µÄ²»Í¬´ÎÊýµÄÊôÐ ......
ÎÒÏÖÔÚÓÐ2¸ö±íTable1£¬Table2¡£¶ÔÓ¦µÄ×ֶΡ¢Êý¾ÝÈçÏ£º
Table1£ºprimary key(a1)
a1(char) a2(int)
a 10
b & ......