導航:首頁 > 數據處理 > 資料庫怎麼查每天數據

資料庫怎麼查每天數據

發布時間:2024-12-29 00:03:53

『壹』 在資料庫中如何查詢當天的數據

以sqlserver為例,假設日期欄位為saledate,則當天sql如下:
select * from [LHDDXkms].[dbo].
[ST_ PPTN _ R ] where STCD =60432099
and DateDiff(dd,saledate,getdate())=0
其他日期,變更最後的and後面即可。
昨天:and DateDiff(dd,saledate,getdate())=1
一周:and DateDiff(dd,saledate,getdate())<=7
一月:and DateDiff(mm,saledate,getdate())=0

『貳』 資料庫查詢某月每天的數據量

set@x:=0;
selectpdays.pday,sum(t.money)
from
(selectpdayfrom
(selectadddate(str_to_date('2013-09-01','%Y-%m-%d'),f1)aspday
from(select@x:=@x+1asf1fromcustomerlimit1,31)t1
)t2wherepday<=last_day(str_to_date('2013-09-01','%Y-%m-%d'))
)pdays
leftjoin銷售表tonpdays.pday=t.date
wheret.name='fff'
groupbypdays.pday

閱讀全文

與資料庫怎麼查每天數據相關的資料

熱點內容
ppt怎麼做數據表格 瀏覽:904
股市數字貨幣怎麼交易 瀏覽:402
現在還有什麼可以代理的 瀏覽:672
車貸分期公司怎麼可以代理 瀏覽:423
NBA2k20手游怎麼交易安東尼 瀏覽:907
北京拍攝什麼市場大 瀏覽:108
鋁壓鑄模生產的產品怎麼有氣孔 瀏覽:940
學習中醫推拿技術哪個好 瀏覽:278
德陽市公共資源交易中心在哪裡 瀏覽:668
小米雲盤信息怎麼刪除 瀏覽:4
怎麼做自運轉產品 瀏覽:875
滬深市場動力煤股票有哪些 瀏覽:524
生物大數據挖掘用什麼語言 瀏覽:304
產品為什麼要按照班產量做 瀏覽:900
哪些學校文科生可以報航海技術 瀏覽:767
安徽省立醫院的就診信息會保留多久 瀏覽:198
應用層數據流向哪裡 瀏覽:170
如何辦理兵役登記社保卡信息採集 瀏覽:555
怎麼轉移相片數據到另一方手機 瀏覽:681
什麼東西屬於農產品 瀏覽:672