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

oracle Ìæ»»Êý¾ÝµÄsql¸ÃÔõôд - Oracle / ¿ª·¢

ÓÐÁ½Õűí
  A B
  id hyid hyid newid
  1 2 2 A
  2 3 3 B
  ÏÖÔÚÒª½«a±íµÄhyid»»³Éb±íµÄnewid,Çë×¢Òâa±íÖеÄhyid²»ÊÇΨһµÄ
  oracleÖиà Ôõô´¦Àí


merge into a using b 
on (a.hyid=b.hyid)
when matched then
update set a.hyid=b.newid  
a.hyid ÔÚon¾äÖÐ,²»ÄÜÐÞ¸Ä

ÎÒÁíÍâÔÚa±íÖÐŪÁËÒ»ÌõÊý¾ÝhyºÍhyid±£³ÖÒ»ÖÂ
²¢ÇÒÒòΪa±íÖеÄhyid²»ÊÇΨһµÄ,½á¹û´íÎóÎÞ·¨»ñµÃÎȶ¨ÐÐ
update a set hyid=(
  select newid from b where hyid=a.hyid)
where exists(
  select 1 from b where hyid=a.hyid)

SQL code:
update a set a.hyid=(select newid from b where b.hyid=a.hyid and rownum<2)
and exists (select 1 from b where b.hyid=a.hyid);


ÒýÓÃ
update a set hyid=(
select newid from b where hyid=a.hyid)
where exists(
select 1 from b where hyid=a.hyid)


1Â¥Õý½â£¬ÓÃmergeÎÞ·¨ÐÞ¸Ä

¿´Ñù×Ó²»´í ,²»¹ý»¹ÊÇÐ޸IJ»ÁË,´íÎó:µ¥ÐÐ×Ó²éѯ·µ»Ø¶à¸öÐÐ
 

--where rownum=1ÏÞÖÆÏÂ

update a set hyid=(
select newid from b where hyid=a.hyid where rownum=1)
where exists(
select 1 from b w


Ïà¹ØÎÊ´ð£º

Asp+sql serverÎÊÌâ - Web ¿ª·¢ / ASP

ÎÒÒ»¸öÏîÄ¿£¬Óиö²åÈë²Ù×÷£¬¾ßÌåÊÇÕâÑùµÄ£º
ÎÒÓнø»õÐÅÏ¢±í¡£ÔÚ³ö»õʱѡÔñÏàÓ¦µÄ½ø»õÐÅÏ¢£¬ÊäÈëÊýÁ¿£¬Ñ¡Ôñ²¿Ãź󣬵㱣´æ°´Å¥£¬ÓÉÓÚÍøÂçÑÓʱ£¬µãÒ»ÏÂûÓз´Ó³£¬ÓÚÊÇÓû§¾ÍÓÖµãһϣ¬µ¼ÖÂÒ»´Î²åÈëÁËÁ½Ìõ¼Ç¼:
Àý£º ......

oracle²¢·¢´¦ÀíSOS - Oracle / ¿ª·¢

ÎÒÔÚ¿ª·¢µÄÕâ¸öÓ¦Óò¢·¢ÐԱȽϸߣ¬oracle¸üÐÂÊý¾ÝʱºòÈçºÎ´¦Àí²¢·¢´¦ÀíÄØ£¿¸÷λ´óÏÀ·¢±íºÃµÄ¹Ûµã°¡£¬ÔÚÏߵȴý£¡
oracleÊý¾Ý¸üÐÂʱ£¬»á×Ô¶¯Ä¬ÈÏÐÐËø¶¨£¬Â¥Ö÷²»Òª²ÙÐÄ£¬Oracle¶Ô²¢Ðд¦ÀíÒѾ­ºÜ³ÉÊìÁË

ÒýÓÃ
oracle ......

MS SQL×÷ÒµÎÊÌâ - MS-SQL Server / Ó¦ÓÃʵÀý

ÈçºÎÔÚSQL2005ÖÐÉ趨¶¨Ê±×÷Òµ£¬±ÈÈç˵¶¨Ê±ÇåÀíijЩ±íµÄÊý¾Ý£¬
»òÕßÊǶ¨Ê±µÄ½«Ä³Ð©±íµÄÊý¾Ýµ¼³öexcel£¡
ÔÚÏߵȴý£¬¼±¼±¼±£¬×îºÃÊÇÏêϸ²½Ö裡
֮ǰÎÒ×öµÄ×÷ÒµÓеãÎÊÌ⣡
°ïUP

²Î¿¼:http://hi.baidu.com/toiota ......

JavaÖ®¸¸À뿪Oracle£¬±¯Í´°¡£¡£¡ - Java / ·Ç¼¼ÊõÇø

¿´µ½ÓÐÒ»¸öSUNµÄÔªÀÏ´ÓOracle¹«Ë¾´ÇÖ°£¬¶øÇÒÊÇJava´´Ê¼ÈË——´óÃû¶¦¶¦µÄJames Gosling£¬
ÐÄÖÐÏ൱ÊÜ´ò»÷£¡ºÜ±¯Í´£¡
OrableÕâÊÇÔõôÁË£¬ÄѵÀÕâ¾ÍÊÇËùνµÄÈںϣ¨Ö«½â£¬·Ö»¯£¬Ïûʧ£©Âð£¿
SUNµÄÒ»°ïÀÏÔ±¹¤¶ ......

OracleÁÙʱ±íʹÓÃÎÊÌâ - Oracle / ¿ª·¢

ÎҵĴ¦ÀíÊÇÕâÑùµÄ£º
ÎÒÓÐÒ»¸öºÜ´óµÄÊý¾Ý¼¯ºÏ£¬´¦ÓÚÐÔÄÜ·½ÃæµÄ¿¼ÂÇÐèҪʹÓÃÁÙʱ±í¹ý¶É£¬²¢ÇÒʹÓ÷ÖÒ³µÄ·½Ê½ÏòÁÙʱ±íÖвåÈëÊý¾Ý£¬Êý¾ÝʹÓÃÍê±Ïºó£¬É¾³ýÁÙʱ±íµÄÊý¾Ý¡£
³öÏÖµÄÏÖÏ󣺵±OracleÖØÐÂÆô¶¯ºó£¬µÚÒ»Ò³²åÈëµÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ