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

ÇóÒ»Ìõoracle¶à±í²éѯµÄsql£¬Çó¸ßÊÖÃDz»ÁߴͽÌ~

table1:
uID    uName
1      СÀî 
2      СÕÅ

table2:
pID  uID  type
1    1    H1
2    2    H2


table3:
uID  teamID
1      T1
1      T2
1      T4
2      T1
2      T3
2      T4
2      T5

table4:
teamID  teamName
T1 Ò½ÁÆ
T2 ¾È»¤
T3 ¼±¾È
T4 Ò½Ò©
T5 ÆäËû

ÏÖÔÚÏëÒªÒ»ÌõSQL²éѯ³öÈçϵĽá¹û

uID  uName        team                  type
1    СÀî  Ò½ÁÆ£¬¾È»¤£¬Ò½Ò©            H1
1    СÕÇ  Ò½ÁÆ£¬¼±¾È£¬Ò½Ò©£¬ÆäËû      H2

Çë¸ßÊÖÃDz»ÁߴͽÌ~~¸Ð¼¤²»¾¡
select a.uid,a.uname,
  wm_concat(d.teamname),
  b.type
from table1 a,table2 b,table3 c,table4 d
where a.uid=b.uid
  and a.uid=c.uid
  and c.teamid=d.teamid
group by a.uid,a.uname,b.type

²»ºÃÒâ˼£¬ÎÒÍü¼Ç˵ÁË£¬ÏµÍ³ÓõÄÊý¾Ý¿âÊÇ9iµÄ£¬Ã»ÓÐwm_concatÕâ¸öº¯Êý£¬»¹ÓÐûÓбðµÄ°ì·¨£¿

ÓÃsys_connect_by_path
http://topic.csdn.net/u/20091010/14/FC773


Ïà¹ØÎÊ´ð£º

SQLÓï¾äÎÊÌ⣬¸ßÊÖ°ï棡£¡

½«Ò»¸ö±í21~30ɾ³ý£¬sqlÓï¾äÔõôд
Õâ¸öÌ«ÁýͳÁË£¬ÊÇÅÅÐòºóµÄµÚ21Ìõµ½30Ìõ¼Ç¼ɾ³ý»¹ÊÇijһÁÐÖµÔÚ21µ½30Ö®¼äµÄɾ³ý°¡£¿

21-30ÊÇʲôÒâ˼£¿×ֶεĻ°¾Ídelete from table1 where col1>=21 and col1<=30
Ö¸µ ......

SQLÓï¾äЧÂÊÎÊÌâ - ÆäËûÊý¾Ý¿â¿ª·¢ / ÆäËûÊý¾Ý¿â

´ó¼Ò°ïæ¿´¿´Õâ2¸ösqlÓï¾äÄĸö²éѯµÄËٶȸü¿ìµã¡£Ð»Ð»°ïæ¡£±È½Ï׿±¡£ÔÚ×öÐÔÄܲâÊÔ¡£
select * from
  ±íA LEFT OUTER JOIN ±íB ON (±íA.id || ' ' =±íB.id) ,±íC , ±íD, ±íE
WhereÆäËûÌõ¼þ
select * ......

ÊÇoracleµÄbugô£¿É¢·ÖÁË£¡ - Oracle / »ù´¡ºÍ¹ÜÀí

±¾À´ÒªÐ´¸öupdateÓï¾ä
update table_a A
  set A.flag=1
  where A.id in (select B.id from table_b B)
½á¹ûÎóд³É
update table_a A
  set A.flag=1
  where ......

oracleµ¼Èë»Ø¹ö - Oracle / ¿ª·¢

abnormal end of export file
IMP-00028: partial import of previous table rolled back: 3828 rows rolled back
  
ÓÐûÓÐÒ»ÖÖ·½·¨Èõ¼Èë¼ÌÐø½øÐжø²»Òì³£Ìø³ö»Ø¹ö£¿
ignore=y

Äã² ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ