如何根据今天的日期从表中显示某些特定月份 [英] how to display some Particular months from table based on today date

查看:108
本文介绍了如何根据今天的日期从表中显示某些特定月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在该表中有一个表12个月列和emp名称列意味着

emp_ name jan feb march april ,,,,,,,,,, dec



表示所有12个月都在那里





在我的查询中我今天通过日期

我的问题是

1)如果我通过feb-01-2014作为日期

i必须显示emp_name jan和feb列名



2)如果我通过march-02-2014作为日期

i必须显示emp_name jan feb march列名



3)如果我通过may-11-2014作为日期

i必须显示列如

emp_name jan feb march 4月可能





请任何人提出查询我的要求

i have one table in that table 12 months column and emp name column means
emp_ name jan feb march april,,,,,,,,,,dec

means all 12 months are there


in my query i am passing today date
my question is
1) if i pass feb-01-2014 as date
i have to display emp_name jan and feb column name

2) if i pass march-02-2014 as date
i have to display emp_name jan feb march column name

3)if i pass may-11-2014 as date
i have to display column like
emp_name jan feb march april may


please can any one give query for my requirement

推荐答案

试试

Try
SELECT * FROM MyTable WHERE DATEDIFF(y, dateColumn, datePassed) = 0


这篇关于如何根据今天的日期从表中显示某些特定月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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