最近10天的收藏展示在窗口中 [英] Last 10 days collection show in window

查看:115
本文介绍了最近10天的收藏展示在窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过查询显示最近10天的收藏。



我尝试过的方法:



I want to show last 10 days collection through query.

What I have tried:

select   CONVERT(DATE, transactionTimestamp) , sum(CAST (replace(amount, ',', '') AS INT)) from Transactions where agentCode=6 Group By  CONVERT(DATE, transactionTimestamp) 





并尝试此查询



and also try this query

select  cast(transactionTimestamp as date) < dateadd(day, -10, getdate())  , sum(amount) from Transactions where agentCode=3   group by cast(transactionTimestamp as date)

推荐答案

所以你必须创建正确的其中声明:



So you have to create correct where statement:

WHERE transactionTimestamp BETWEEN DATEADD(D, -10, GETDATE()) AND GETDATE()





欲了解更多详情,请参阅:

DATEADD(Transact-SQL) - SQL Server Microsoft Docs [ ^ ]


这篇关于最近10天的收藏展示在窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆