CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2000
    Posts
    47

    SQL statement for specific month

    hello,

    is there any way to retrieve for records that the datefield match only the specific month of a year.

    for example:
    if I want to retrieve the expenses record that occur in the month of january.

    really need your help.

    best regard usin.





  2. #2

    Re: SQL statement for specific month

    In SQL Server,

    SELECT * FROM MYTABLE WHERE DATEPART(mm, MYDATEFIELD) = 01




  3. #3
    Join Date
    May 2000
    Posts
    47

    Re: SQL statement for specific month

    thank you very much.

    i have rated you excellent.


    usin.


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: SQL statement for specific month

    Also you can use
    select * from table where Month(YourDate) = 05

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured