sql Óï¾ä
±íA
¿¨ºÅ ʱ¼ä
1 null
2 null
3 null
±íB
¿¨ºÅ ʱ¼ä
1 2008-1-6
1 2004-5-3
2 2005-5-6
3 2003-5-9
3 2001-2-3
ÎÊÌ⣺¸üР±íAÀïµÄ ÏàÓ¦¿¨ºÅµÄʱ¼äΪ ±íBÀïÏàÓ¦¿¨ºÅµÄ£¨×îС£©Ê±¼ä
ÕýÈ·µÄ½á¹û£º
1 2004-5-3£¨×îС£©
2 2005-5-6
3 2001-2-3£¨×îС£©
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.ʱ¼ä)
SQL code:
update t set ʱ¼ä=(select min(ʱ¼ä) from tb where ¿¨ºÅ=t.¿¨ºÅ) from ta t
SQL code
Code highlighting produced by
Ïà¹ØÎÊ´ð£º
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......
with adod_dict do
begin
close;
commandtext:='select bgqxcode,count(*) wjsl from wscl_wsda_file where wjnd=:tnd group by bgqxcode'; ......
ÓÐÒ»¸ö±í½á¹¹ÈçÏ£º
ÎïÆ·±àÂë ʹÓôÎÊý Ãû³Æ ÊôÐÔ1£¬ÊôÐÔ2.¡£¡£¡£¡£¡£¡£
ÆäÖУ¬Ç°Á½ÏîΪÖ÷¼ü£¨ÎïÆ·±àÂë ʹÓôÎÊý£©£¬´ÎÊý×î¶àΪ5
ÏÖÔÚÎÒÏë°Ñ ͬһÖÖÎïÆ·µÄ²»Í¬´ÎÊýµÄÊôÐ ......
Á½ÖÖ´íÎó£º
1.Èç¹ûÎÒÕâÑùÉêÃ÷£ºResultSet rs;´íÎóÌáʾÈçÏ£º
An error occurred at line: 51 in the jsp file: /index.jsp
The local variable rs may not have been initialized
48: ......