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
Ïà¹ØÎÊ´ð£º
±¾ÈËc#ÐÂÊÖ ¿ÉÊÇÒªÇóÒªÓÃc# £¬sql2000¿ª·¢c/sµÄ¹¤×÷Á÷£¬Ò»Í·ÎíË®£¬Çë´ó¼Ò°ïæ°ï棬¸øµã˼·£¬ËµµÄÔ¼¾ßÌåÔ½ºÃ£¬ÎÒÒ²ºÃÍùÄǸö·½ÃæÈ¥Ñ§Ï°
http://www.hxzi.com/view/61402.html
B/S°æµÄ£¬»ù±¾Ë¼ÏëÓ¦¸Ã²î²»¶àµÄ¡£¡£ ......
Êý¾Ý±í¡¾biao¡¿£¬
×ֶΣºid¡¢myname¡¢mytxt
mytxtÄÚÈݸñʽÐÎÈ磺n|abcd¡££¨ÀýÈ磺1|ÁõµÂ»ª£¬2|Èδﻪ£¬3|αÌϼ£¬4|Âõ¿Ë@½Ü¿ËÑ·£©
ÎÒÏÖÔÚÏ£Íû¶Á¼Ç¼³öÀ´ºó£¬°´ÕÕ[mytxt]×Ö¶ÎÀïµÄÊúÏߣ¨|£©Ç°ÃæµÄÄǸöÊý× ......
ÇëÎʸ÷룬ÈçºÎ½«SQlÖУ¬Ä³×Ö¶ÎÖеÄÖµºáÏòÕ¹¿ªÄØ£¬
CASE WHEN
¾ßÌåÎÊÌâ¾ßÌå·ÖÎö£¬¿´ÄãÒªÔõôչ¿ª
ÐÕÃû ¿ÆÄ¿ ³É¼¨
ÕÅÈý Ó¢Óï 90
ÀîËÄ Ó¢Óï&nb ......
sql¿ÉÒÔÓÐÁ½¸öÒÔÉϵĴ¥·¢Æ÷Â𣿣¿ÎÒÖ¸µÄÊÇfor´¥·¢Æ÷£¬ÄÇÆäËûµÄÄØ£¿£¿
ʲôÒâ˼£¿
¿ÉÒÔµÄ
10¸ö¶¼Ã»ÎÊÌâ
¿ÉÊÇÎÒдÁËÁ½¸öfor insert ´¥·¢Æ÷£¬Ôì³É½ø³Ì×èÈûÁËÄØ£¿Ôõô°ìÄØ£¿Çë¸ßÈËÖ¸µã
......
£¨1£©string ConnString = "server=localhost;integrated security=sspi;database=pubs;";
£¨2£©string strConnection="user uid=sa;pwd=123456;Database=test;Server=test;Connect ......