查询以月为单位返回输出 [英] Query to return output month wise

查看:95
本文介绍了查询以月为单位返回输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有1张桌子是休假的:

ID名称DateofBirth
1.阿米特(Amit)07.03.1987
2. Vikrant 20.01.1987


我想编写查询,这将按月返回输出.

这个月有所有有这个月生日的朋友名字.

我想这样输出:

身份证月份名称
2. Jan Vikrant
1. March Amit


请给我查询以获取我的输出.

在此先感谢.

Hi,

I have 1 table this is fallow:

ID Name DateofBirth
1. Amit 07.03.1987
2. Vikrant 20.01.1987


I want to write query this will return the output by Month.

This month have all friend name those have Birthday of this month.

I want to ouput like this:

ID Month Name
2. Jan Vikrant
1. March Amit


Please give me the query to get my output.

Thanks in Advance.

推荐答案

SELECT DateName(MONTH,ModifiedDate)AS 'Month', CName FROM TempData 


尝试这个.


Try this one.


看看这个 ^ ].


这将为您提供一个月号.在 DATENAME 中查找文字.
This will give you a month number. Look at DATENAME for text.
SELECT ID, MONTH(DateOfBirth), Name
FROM MyTable


这篇关于查询以月为单位返回输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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