Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎÊ´ð£º

OracleÀëÏß·ÃÎÊ---ÇóÖú - Oracle / »ù´¡ºÍ¹ÜÀí

´ó¼ÒºÃ,ÎÒÏÖÔÚ°Ñoracle·þÎñÆ÷ÉÏÃæµÄԭʼÎļþ,ÏÂÔØµ½±¾»úÁË.ÎÒÏëÔÚ±¾»ú·ÃÎÊÊý¾Ý¿âÔõôÉèÖð¡.ÊDz»ÊÇÀàËÆ¿ÉÒÔ½¨Á¢Ò»¸öʲôÐéÄâ·þÎñÆ÷À´ÊµÏÖ.Çë´ó¼Ò³ö³öÖ÷Òâ
ÒýÓÃ
    ´ó¼ÒºÃ,ÎÒÏÖÔÚ°Ñoracle·þÎñÆ÷ÉÏÃæ ......

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

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

Çë½ÌsqlÓï¾ä¡£ - Oracle / ¿ª·¢

ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
  ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......

Êý¾ÝÒÔxml¸ñʽ·µ»Ø - MS-SQL Server / Ó¦ÓÃʵÀý

´ÓÊý¾Ý¿âÖвéѯһÕűíµÄÊý¾Ý
select ²¿ÃÅ,ÐÕÃû from tb
ÈçºÎ²ÅÄÜÉú³ÉÏÂÃæµÄxml¸ñʽ
XML code:
<folder state="unchecked" label="È«²¿">
¡¡¡¡ <folder state="unchecked&qu ......

[Ô­´´] ORACLE Á¬½Ó×Ö´® - Oracle / ·Ç¼¼ÊõÇø

¼ÙÉètable01 ÖÐÓÐ ÒÔÏÂ×ÊÁÏ
emp_no emp_name
------- ------------
0001 TOM
0002 JOHN
0003 MARY
³£Óõ绰 
¶øÎÒÃÇÒªµÃµ½ÒÔϵÄOUTPUT (»òÊǸ÷ÖÖÆäËûµÄoutput)
0001,TOM
0002,JOHN ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ