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

sqlÓï¾ä×ܽá¶þ

sql¾«ÃîÓ÷¨
ÎÄÕ·ÖÀà:Êý¾Ý¿â
˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ,Ô´±íÃû£ºa бíÃû£ºb)
select * into b from a where 1<>1
˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý,Ô´±íÃû£ºa Ä¿±ê±íÃû£ºb)
insert into b(a, b, c) select d,e,f from b;
˵Ã÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
˵Ã÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa ±íÃû2£ºb)
select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
˵Ã÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ
select * from Èճ̰²ÅÅ where datediff('minute',f¿ªÊ¼Ê±¼ä,getdate())>5
˵Ã÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾ­ÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
delete from info where not exists ( select * from infobz where info.infid=infobz.infid )
˵Ã÷£º--
SQL:
SELECT A.NUM, A.NAME, B.UPD_DATE, B.PREV_UPD_DATE
from TABLE1,
(SELECT X.NUM, X.UPD_DATE, Y.UPD_DATE PREV_UPD_DATE
from (SELECT NUM, UPD_DATE, INBOUND_QTY, STOCK_ONHAND
from TABLE2
WHERE TO_CHAR(UPD_DATE,'YYYY/MM') = TO_CHAR(SYSDATE, 'YYYY/MM')) X,
(SELECT NUM, UPD_DATE, STOCK_ONHAND
from TABLE2
WHERE TO_CHAR(UPD_DATE,'YYYY/MM') =
TO_CHAR(TO_DATE(TO_CHAR(SYSDATE, 'YYYY/MM') || '/01','YYYY/MM/DD') - 1, 'YYYY/MM') ) Y,
WHERE X.NUM = Y.NUM £¨+£©
AND X.INBOUND_QTY + NVL(Y.STOCK_ONHAND,0) <> X.STOCK_ONHAND ) B
WHERE A.NUM = B.NUM
˵Ã÷£º--
select * from
studentinfo where not exists(select * from student where
studentinfo.id=student.id) and ϵÃû³Æ='"&strdepartmentname&"' and
רҵÃû³Æ='"&strprofessionname&"' order by ÐÔ±ð,ÉúÔ´µØ,¸ß¿¼×ܳɼ¨
´ÓÊý¾Ý¿âÖÐÈ¥Ò»ÄêµÄ¸÷µ¥Î»µç»°·Ñͳ¼Æ(µç»°·Ñ¶¨¶îºØµç»¯·ÊÇåµ¥Á½¸ö±íÀ´Ô´£©
SELECT a.userper, a.tel, a.standfee, TO_CHAR(a.telfeedate, 'yyyy') AS telyear,
SUM(decode(TO_CHAR(a.telfeedate, 'mm'), '01', a.factration)) AS JAN,
SUM(decode(TO_CHAR(a.telfeedate, 'mm'), '02', a.factration)) AS FRI,
SUM(decode(TO_CHAR(a.telfeedate, 'mm'), '03', a.factration)) AS MAR,
SUM(decode(TO_CHAR(a.telfeedate, 'mm'), '04', a.factrat


Ïà¹ØÎĵµ£º

Oracle ²éѯ²¢É¾³ýÖظ´¼Ç¼µÄSQLÓï¾ä


²éѯ¼°É¾³ýÖظ´¼Ç¼µÄSQLÓï¾ä
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select   peopleId from   people group by   peopleId having count(peopleId) > 1)
 
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊÇ ......

SQLÖ® case when then

 ÊÓͼ²éѯÖÐÔõÑù½«Ô­¶¨ÓÚÈçÐÔ±ðsex ÕâÑùµÄ×ֶΣ¬×Ö¶ÎֵΪ0£¬1ÕâÑùµÄintÀàÐÍÖµ£¬²éѯʱֱ½Ó·µ»Øvarchar
Ð͵Ä×Ö·û‘ÄÐ’£¬‘Å®’ÒÔ±ãÓÚÎÒÃǶÁÈ¡ÄØ£¿
      
ÓÐÈË»áÏëµ½if …else…ÕâÑùµÄÓï¾ä£¬¿ÉÊÇÔõô¼Ó£¬¶¼²»ÖªµÀ¼ÓÄÄÀÒòΪ×ÜÊÇ»á³ö´í¡£Æä ......

SQLµÄ¼¸¸ö±àÂë¹æ·¶


1.±ÜÃâÔÚwhere×Ó¾äÖжÔ×Ö¶ÎÊ©¼Óº¯Êý£¬ÕâÑù½«µ¼ÖÂË÷ÒýʧЧ£¬±ÈÈ磺
select * from user where
to_char(create_time,'yyyymmdd')='20090101';
Ô­Òò£ºÔÚ½¨Á¢indexµÄʱºòÊǸù¾Ý×Ö¶ÎÀ´½¨Á¢µÄ£¬Ò²¾ÍÊÇ˵oracleÔÚinidexµÄʱºòÊÇË÷ÒýµÄ×ֶεÄÖµ£¬Èç¹ûÌṩ¸øoracleµÄÊÇÒ»¸öÐèÒª¾­¹ýº¯Êý´¦ÀíµÄ±È½Ï£¬oracle¾Íû°ì·¨Í¨¹ýË÷ÒýÖÐµÄ ......

SQL×¢Èë½Ì³ÌÖ®ÈëÃÅƪ

Èë Êƪ
Èç¹ûÄãÒÔǰûÊÔ¹ýSQL×¢ÈëµÄ»°£¬ÄÇôµÚÒ»²½ÏÈ°ÑIE²Ëµ¥=>¹¤¾ß=>InternetÑ¡Ïî=>¸ß¼¶=>ÏÔʾÓѺà HTTP ´íÎóÐÅϢǰÃæµÄ¹´È¥µô¡£·ñÔò£¬²»ÂÛ·þÎñÆ÷·µ»Øʲô´íÎó£¬IE¶¼Ö»ÏÔʾΪHTTP 500·þÎñÆ÷´íÎ󣬲»ÄÜ»ñµÃ¸ü¶àµÄÌáʾÐÅÏ¢¡£
µÚÒ»½Ú¡¢SQL×¢ÈëÔ­Àí
ÒÔÏÂÎÒÃÇ´ÓÒ»¸öÍøÕ¾www.19cn.com¿ªÊ¼£¨×¢£º±¾ÎÄ·¢±íÇ°ÒÑÕ÷µ ......

½â¾ö£ºSQL Server·þÎñÎÞ·¨Æô¶¯

Æô¶¯SQL Server (SQLEXPRESS)·þÎñʱÌáʾ´íÎó£¬Ê¼þ²é¿´Æ÷ÏÔʾÒÔÏÂÐÅÏ¢£¨ID 9003£©£º
´«µÝ¸øÊý¾Ý¿â 'master' ÖеÄÈÕ־ɨÃè²Ù×÷µÄÈÕ־ɨÃèºÅ (276:232:1) ÎÞЧ¡£´Ë´íÎó¿ÉÄÜָʾÊý¾ÝË𻵣¬»òÕßÈÕÖ¾Îļþ(.ldf)ÓëÊý¾ÝÎļþ(.mdf)²»Æ¥Åä¡£Èç¹û´Ë´íÎóÊÇÔÚ¸´ÖÆÆÚ¼ä³öÏֵģ¬ÇëÖØд´½¨·¢²¼¡£·ñÔò£¬Èç¹û¸ÃÎÊÌâµ¼ÖÂÆô¶¯ÆÚ¼ä³ö´í£¬Çë´Ó± ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ