Demo

討論

保持飢餓,保持愚笨 (Stay hungry, stay foolish)。 史蒂夫·賈伯斯

公告

本網站已取消討論區的討論方式,如果您有問題請至LINE群行動條碼圖片網址,或Facebook社團

日期有關範例

More
2006-05-15 16:04 #2434 來自 Eddy
Eddy created the topic: 日期有關範例
找特定一天的值
SELECT hits
FROM `jos_counter`
WHERE cid =1
AND STRCMP(
`r_date` , '2006-01-06'
) =0
LIMIT 0 , 30


找特定月的值
SELECT sum( `hits` )
FROM `jos_counter`
WHERE cid =1
AND MONTH( `r_date` ) =1
AND YEAR( `r_date` ) =2006

SELECT sum(`hits`)
FROM `jos_counter`
WHERE cid =1
AND STRCMP(
MONTH( `r_date` ) , '1'
) =0
AND STRCMP(
YEAR( `r_date` ) , '2006'
) =0

SELECT *
FROM jos_dodoevent
WHERE MONTH( `start_date` ) =1
AND YEAR( `start_date` ) =2006

找特定年的值
SELECT sum(`hits`)
FROM `jos_counter`
WHERE cid =1
AND STRCMP(
YEAR( `r_date` ) , '2006'
) =0
LIMIT 0 , 30


知之者不如好之者,好之者不如樂之者

Please 登入 to join the conversation.