Results 1 to 4 of 4

Thread: SQL current month and next month

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    SQL current month and next month

    Hi all.
    I am having problem with SQL syntax.
    I want to display data from a table called permohonan.
    The conditions are;
    1)The field jpk must equal to 1
    2)The field sokong must null.
    And the other condition is which I dont know how to write in SQL, which is I want to retrieve data from permohonan where the date is 1st day of current month untill 5th day of next month.

    Code:
    Select * from permohonan where jpk = 1 and sokong is null and ....
    I really dont have any idea how to do this.
    Can SQL capture the current month?
    Hope, you can help me.
    Thanks in advance.

  2. #2
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: SQL current month and next month

    Quote Originally Posted by azrina
    Hi all.
    I am having problem with SQL syntax.
    I want to display data from a table called permohonan.
    The conditions are;
    1)The field jpk must equal to 1
    2)The field sokong must null.
    And the other condition is which I dont know how to write in SQL, which is I want to retrieve data from permohonan where the date is 1st day of current month untill 5th day of next month.

    Code:
    Select * from permohonan where jpk = 1 and sokong is null and ....
    I really dont have any idea how to do this.
    Can SQL capture the current month?
    Hope, you can help me.
    Thanks in advance.
    Please read this article CAREFULLY: http://vbforums.com/showthread.php?t=333942

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2004
    Posts
    100

    Re: SQL current month and next month

    Hmm..
    I am using MS Access 2003.
    Language Used: ASP
    Connection Method: ADODB

  4. #4
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: SQL current month and next month

    Quote Originally Posted by azrina
    Hmm..
    I am using MS Access 2003.
    Language Used: ASP
    Connection Method: ADODB
    Tha makes it easier to help

    Put this in the WHERE clause
    Code:
    DateColumn between dateadd(""d"",-day(date())+1,date()) and 
    dateadd(""m"",1,dateadd(""d"",-day(date())+5,date()))
    Last edited by Hack; Apr 28th, 2006 at 06:58 AM.

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