|
查看: 1930|回复: 5
|
Current Month
[复制链接]
|
|
|
|
请问一下,SQL select statement 有没有办法选出 'current month' 的records吗? |
|
|
|
|
|
|
|
|
|
|
发表于 5-3-2010 02:28 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 5-3-2010 03:40 PM
|
显示全部楼层
好比以下???- select cust_name, inv_date, inv_no, inv_amt from INVOICE where (select month(inv_date) as month = (select MONTH(CURRENT_DATE())) and ORDER BY inv_no
复制代码 |
|
|
|
|
|
|
|
|
|
|
发表于 5-3-2010 06:40 PM
|
显示全部楼层
你可以尝试一下 t-sql
- SELECT * FROM (SEELCT cust_name, inv_date, inv_no, inv_amt, DATENAME(month, inv_date) AS tmonth FROM INVOICE) AS Table1
- WHERE (tmonth = 'March')
- ORDER BY inv_no
复制代码 |
|
|
|
|
|
|
|
|
|
|
发表于 11-6-2010 06:09 PM
|
显示全部楼层
本帖最后由 html 于 11-6-2010 06:13 PM 编辑
Get the current month value: Month(getdate()) or Datename(m,getdate()) |
|
|
|
|
|
|
|
|
|
|
发表于 7-7-2010 05:48 PM
|
显示全部楼层
|
Month("Your Month Column") = Month(GETDATE()) |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|