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
Ïà¹ØÎÊ´ð£º
ÎÒÔÚ¿ª·¢µÄÕâ¸öÓ¦Óò¢·¢ÐԱȽϸߣ¬oracle¸üÐÂÊý¾ÝʱºòÈçºÎ´¦Àí²¢·¢´¦ÀíÄØ£¿¸÷λ´óÏÀ·¢±íºÃµÄ¹Ûµã°¡£¬ÔÚÏߵȴý£¡
oracleÊý¾Ý¸üÐÂʱ£¬»á×Ô¶¯Ä¬ÈÏÐÐËø¶¨£¬Â¥Ö÷²»Òª²ÙÐÄ£¬Oracle¶Ô²¢Ðд¦ÀíÒѾºÜ³ÉÊìÁË
ÒýÓÃ
oracle ......
ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄÇ°2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......
ÎҵĴ¦ÀíÊÇÕâÑùµÄ£º
ÎÒÓÐÒ»¸öºÜ´óµÄÊý¾Ý¼¯ºÏ£¬´¦ÓÚÐÔÄÜ·½ÃæµÄ¿¼ÂÇÐèҪʹÓÃÁÙʱ±í¹ý¶É£¬²¢ÇÒʹÓ÷ÖÒ³µÄ·½Ê½ÏòÁÙʱ±íÖвåÈëÊý¾Ý£¬Êý¾ÝʹÓÃÍê±Ïºó£¬É¾³ýÁÙʱ±íµÄÊý¾Ý¡£
³öÏÖµÄÏÖÏ󣺵±OracleÖØÐÂÆô¶¯ºó£¬µÚÒ»Ò³²åÈëµÄ ......
ÕâÀïÏëÁ˽âÏ£¬¹ØÓÚSQL ServerÖзÖÒ³ºÍOracleÖзÖÒ³£»
ƽ³£Ð´Ó¦ÓóÌÐòµÄʱºò£¬±ÈÈçÓõÄÓïÑÔÊÇJava£¬ÓиöÁбíÒ³Ã棬ÐèÒª¶ÔÊý¾Ý·ÖÒ³ÏÔʾ£»
ÕâÀïÒª·ÖÒ³ÄѵÀ²»ÐèÒª½èÖúJava£¬¶øÖ±½ÓsqlÄÜÖªµÀ·ÖÒ³Âð£¬ÆðÂëÒ²Òª´«¸öÒ³Âë½ ......
Ö´ÐÐÊý¾Ý¿â²Ù×÷ʱ£¬Ö±½ÓÓÃSQL Óï¾äºÃһЩ »¹ÊÇÓô洢¹ý³Ì¸ü¼ÑÄØ£¿
¸÷ÊãÆð¼û
Õâ¸öµÄ¾ßÌåÎÊÌâ¾ßÌå·ÖÎö
¼òµ¥µÄselect ¡¢updateºÍinsertµ±È»sql½â¾öÁË
¸´ÔӵķÅÔÚsql·þÎñ¶ËÓ¦¸ÃºÃµã
Â¥Ö÷Çë²ÎÔÄ
http://msdn.micr ......