从SQL Server数据库获取月份 [英] To get the month from a sql server database
本文介绍了从SQL Server数据库获取月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的项目中,我必须查看每月销售额.在数据库中,我有一个名为sales的视图,其中包含dd/MM/yy格式的日期字段.我如何查看特定月份的销售额.
In my project I have to see the monthy sales.In the database I''m having a view named sales, which consist of date field in dd/MM/yy format.How can I see the sales of a particular month.
推荐答案
u可以在where子句中使用"SQL" month()函数查看特定月份的销售额.
u can see the sales of particular month using "SQL" month() function in where clause as.
select * from tablename where month(columname) = month value
:)
试试这个
从表名中选择*,其中DateName(mm,columname)=月值
请参考 http://msdn.microsoft.com/en-us/library/ms174395.aspx [ ^ ]
:thumbsup:
Hi,
Try this
select * from tablename where DateName(mm,columname) = month value
Refer http://msdn.microsoft.com/en-us/library/ms174395.aspx[^]
:thumbsup:
使用where子句
很简单 作为
simple by using where Clause
as
select * from tablename where columname = value
这篇关于从SQL Server数据库获取月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文