SQL Help !! - Oracle / ¿ª·¢
ÈçÌ⣺
SQL code:
SELECT TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W'),
COUNT(*)
from T_LIST
WHERE to_char(to_date(ACCEPT_TIME,'yyyy-mm-dd hh24:mi:ss'),'MM')=to_char(SYSDATE-1,'MM')
GROUP BY TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W')
ORDER BY TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W') ;
Ò»¸öÔµÄÖܱ¨±í µ±Ä³Ò»ÖÜûÊý¾Ýʱ Ôõô°ÑÄÇÒ»ÖÜÏÔʾ³öÀ´ ½á¹ûÏÔʾΪ0;
T_list ÊÇÒ»¸ö²Ù×÷Á÷Ë®±í ACCEPT_TIMEÊDzÙ×÷ʱ¼ä¡£
ÔÚÏߵȴ𰸣¡£¡Ï£Íû¸÷λ´ó´ó °ïÏÂæ¡£¡£
°ï¶¥, ºöÓƼǵøøÎÒ·Ö```
SQL code:
SELECT null(TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W'),0),
COUNT(*)
from T_LIST
WHERE to_char(to_date(ACCEPT_TIME,'yyyy-mm-dd hh24:mi:ss'),'MM')=to_char(SYSDATE-1,'MM')
GROUP null(TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W'),0)
ORDER BY null(TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W'),0) ;
SQL code:
--±ÊÎó,Ó¦¸ÃÊÇnvl£¨£©º¯Êý
SELECT nvl(TO_CHAR(TO_DATE(ACCEPT_TIME, 'yyyy-mm-dd hh24:mi:ss'), 'W'),0),
COUNT(*)
from T_LIST
WHERE to_char(to_d
Ïà¹ØÎÊ´ð£º
¿ÉÄÜÒòΪ¹¤×÷µÄÔÒò ½Ó´¥Êý¾Ý¿âÕâ¿é±È½ÏÉÙ£¬Ö®Ç°¶¼ÊÇ×ö³ÌÐòÕâ¿é£¬Êý¾Ý¿âÕâ¿é¶¼ÓÐרÃŵÄÈËÀ´×ö ·Ö¹¤¶¼ºÜÃ÷ϸ ËùÒÔ¶ÔÊý¾Ý¿âÕâÒ»¿éÍêÈ«²»Á˽⡣ǰ¶Îʱ¼ä È¥ÃæÊÔÁ˼¸¼Ò¹«Ë¾ ¼¸ºõ¶¼ÊÇÔÚÊý¾Ý¿âÕâ¿é¹ÒµôµÄ Á¬¸ö¼òµ¥µÄSQ ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ã棬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
select distinct '1' t1,'2' t2,'3' t3,'4' t4 from table ²é³öÀ´µÄ½á¹ûΪ
1,2,3,4
ÎÒÏëµÃÒÔÏÂÕâÑùµÄЧ¹û
1
2
3
4
ÇëÎÊÒ»ÏÂÓÐʲô°ì·¨¿ÉÒÔ½â¾ö???
ûÓкõķ½·¨£¬ÓÃunion£¬Ò»ÌõÌõ¼Ç¼ƴ½Ó
SQL code:
wi ......
ÎÒÓÃmyeclipseÁ¬½ÓOracleÒ»Ö±±¨´í£¬Ò»ÏÂÊDZ¨´í½Øͼ£¬
Çó¸ßÈËÏàÖú¡£
ÎÞͼÎÞÕæÏà....
file:///C:/Documents%20and%20Settings/Administrator/×ÀÃæ/SF/Oracle%20JDBCÁ¬½Ó´íÎó.png
....
Äã¿´¿´Çý¶¯ºÍORACLEµÄ°æ ......