Selecting Records based on selcted date range

  • i want to select the values based on the selected year month

    i have one table with RegisterDate field and site id.

    It is datetime and data is store in that as 01/12/2000 so on

    If User selects from date as 03/1999 and to date as 04/2000

    i have to selects the records where RegisterDateis between 03/1992 and 04/1994

    but if i give that it is not showing me any values

    this is the query ..i have records in the table with the values in

    registerdate field which fall under the range...so how to build the

    sql statement to get those records...

    like i want to show the records where RegisterDate = 03/1992,04/1992 ....

    01/1993,12/1993....01/1994...because all these will fall under the selected range.

    SELECT a.site_id,a.RegisterDate

    from cdh_slt a

    where a.RegisterDate between 03/1992 and 12/1994

    order by a.RegisterDate

    so let me know the details asap....

    thanks

  • Remember quotes and put date in a proper date format with a day included:

    
    
    SELECT a.site_id,a.RegisterDate
    from cdh_slt a
    where a.RegisterDate between '03/01/1992' and '12/31/1994'
    order by a.RegisterDate

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply