新聞中心
假設(shè)SQLite數(shù)據(jù)庫中有個(gè)表UserConsume,其中有一列rowTime,該列類型是datetime,怎么統(tǒng)計(jì)該表本月和本周的數(shù)據(jù)?接下來我們給出了統(tǒng)計(jì)的代碼。

成都創(chuàng)新互聯(lián)專注于成都網(wǎng)站制作、成都做網(wǎng)站、網(wǎng)頁設(shè)計(jì)、網(wǎng)站制作、網(wǎng)站開發(fā)。公司秉持“客戶至上,用心服務(wù)”的宗旨,從客戶的利益和觀點(diǎn)出發(fā),讓客戶在網(wǎng)絡(luò)營銷中找到自己的駐足之地。尊重和關(guān)懷每一位客戶,用嚴(yán)謹(jǐn)?shù)膽B(tài)度對(duì)待客戶,用專業(yè)的服務(wù)創(chuàng)造價(jià)值,成為客戶值得信賴的朋友,為客戶解除后顧之憂。
--統(tǒng)計(jì)本月數(shù)據(jù)的代碼 如下:
- select *
- from UserConsume
- where rowTime between datetime('now','start of month','+1 second') and
- datetime('now','start of month','+1 month','-1 second')
--統(tǒng)計(jì)本周數(shù)據(jù)的代碼如下:
- select *
- from UserConsume
- where rowTime between datetime(date(datetime('now',strftime('-%w day','now'))),'+1 second')
- and datetime(date(datetime('now',(6 - strftime('%w day','now'))||' day','1 day')),'-1 second')
關(guān)于SQLite數(shù)據(jù)庫統(tǒng)計(jì)數(shù)據(jù)就介紹到這里了,如果您想了解更多數(shù)據(jù)庫的知識(shí),也可以去看看這里的文章:http://database./,您的收獲是我***的快樂!
【編輯推薦】
- SQLite FAQ常見問題解答
- SQLite 基本控制臺(tái)命令簡(jiǎn)介
- SQLite數(shù)據(jù)庫簡(jiǎn)介之對(duì)表的操作
- MSSQL數(shù)據(jù)庫跨表和跨數(shù)據(jù)庫查詢方法簡(jiǎn)介
- NetApp Filers提高數(shù)據(jù)庫的可用性和可靠性
本文題目:在SQLite中統(tǒng)計(jì)本周本月數(shù)據(jù)的代碼實(shí)例
標(biāo)題鏈接:http://www.5511xx.com/article/codeccj.html


咨詢
建站咨詢
