SQLÓï¾ä
±ítrans(transID,lastDate)
±íTransdetail(transID,voidDate)
ÎÒÒªµÄЧ¹ûÊÇ,µ±lastDate=voidDateʱ,UPDATE±íTransDetailÖеÄTransID¸úTransÖеÄtransIDÒ»Ñù
update Transdetail as a
set TransID=(select transID from Trans where lastDate=a.voidDate)
update TransDetail t set t.transID=(select s.transID from trans s where s.lastDate=t.voidDate)
where t.transID in (select s.transID from trans s where s.lastDate=t.voidDate)
ÐÞ¸ÄÒ»ÏÂ
update Transdetail as a
set TransID=(select transID from Trans where lastDate=a.voidDate)
where voidDate in (select lastDate from Trans)
¶¼ÄÇô¿ì,ˢоͱäÁË
Âß¼ÓÐÎÊÌ⣬ÈçÓÐͬÑùµÄlastDate£¬ µ«²»Í¬µÄtranid£¿
strSql1 = "select distinct transID,lastDate from trans"
Set rst1 = Cn.OpenResultset(strSql1, rdOpenStatic)
If Not rst1.EOF Then
strSql2 = "select distinct voidDate from Transdetail"
Set rst2 = Cn.OpenResultset(strSql2, rdOpenStatic)
If Not rst2.EOF Then
For i = 0 To rst.RowCount - 1
If rst1!lastDate = rst2!voidDate Then
strSql3 = "UPDATE TransDetail SET transID= '" &am
Ïà¹ØÎÊ´ð£º
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±í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'; ......
±íÖа´datadate,tradeidΪÖ÷¼ü£¬Ò²¾ÍÊÇ˵tradeid»áÖØ¸´³öÏÖÔÚ²»Í¬ÌìÖУ¬Í¬Ò»ÌìµÄtradeidÊDz»Í¬µÄ¡£ÏÖÔÚÎÒÏ£Íûȡһ¶Îʱ¼ä·¶Î§ÄÚ²»Öظ´µÄtradeid£¬ÇÒֻҪÿ¸ötradeidµÄ×îºóÒ»´Î³öÏÖµÄÄÇÌõ¡£sqlÓï¾ä¸ÃÔõôд
£º ......
»·¾³£º1.win2003server+oracle9i
2.oracle9i×Ö·û¼¯ÎªAMERICAN_AMERICA.WE8ISO8859P1
3.oracle sql developer°æ±¾ 1.5.5
ÏÖÏóÃèÊö: 1.ÔÚsql developer ÖвéѯoracleÖеÄij¸ö±í£¬ÖÐÎÄÈ«²¿ÏÔʾΪÂÒÂë¡£
......