开发者

Date/time query from Access table ( last month)

I am using the query builder from Visual Studio 2008 to extract data from an A开发者_开发百科ccess mdb ( 2003), but I can't make it to work with a datetime field. When I run it with a third party query app I have works fine, but when I try to implement it into visual studio I can't do it.

What is the correct way to extract last month data?

This is what I have:

SELECT 
  [Datos].[ID], [Datos].[E-mail Address], [Datos].[ZIP/Postal Code], [Datos].[Store], [Datos].[date], [Datos].[gender], [Datos].[age]
 FROM 
  [Datos]
 WHERE 
  ([Datos].[date] =<|Last month|>)

Any help is appreciated.

Thank you


If you want to hardwire it:

where ([Datos].[date] <= #12/31/2009#)

if you want to make it flexible this (might work):

where ([Datos].[date] <= datediff('d',-day(date()),date()))

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜