如何在数据库中按天,每周,每月跟踪日期 [英] How can I track the date by daily, weekly, monthly in database

查看:162
本文介绍了如何在数据库中按天,每周,每月跟踪日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我如何每天,每周,每月跟踪数据库中的日期。我正在创建每日,每周和每月的销售报告。



提前谢谢。

Anyone can help me how to track the date in my database for daily, weekly, monthly. Im creating an sales report for daily, weekly and monthly.

Thanks in advance.

推荐答案

嘿,你可以这样做



For Daily Write SQL赞

Hey, you can do like

For Daily Write SQL Like
Select Day(getdate()) as Daily from table_name group by Daily





每月写SQL一样



For Monthly Write SQL Like

Select Month(getdate()) as Monthly from table_name group by Monthly





对于Yerly写SQL喜欢



For Yerly Write SQL Like

Select Year(getdate()) as Yearly from table_name group by Yearly







只需使用您的日期列名称重放getdate()函数,使用您的表名重放table_name。



多数民众赞成: - )




Just replay the getdate() Function with your date column name and table_name with your table name.

Thats ALL :-)


这篇关于如何在数据库中按天,每周,每月跟踪日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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