Results 1 to 6 of 6

Thread: SQL Statement - please help !Solved!

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395

    SQL Statement - please help !Solved!

    I have a access DB with 2 fields "StartDate" and "EndDate"
    I need now a SQL Statement which gives me all the
    records which are falling in today.

    Thanks in advance
    Last edited by Bongo; Mar 10th, 2002 at 04:32 AM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    you want startdate for today or end date for today??


    "SELECT * from mytable where startdate = " & datepart(now())

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395
    actually no

    I need to know which record is today. - hang on

    This app i am writing is an Reservation system
    StartDate is arrival and EndDate is Depature

    But I wnad to know how many rooms are booked today

    so I need somthing like

    select count(*) from table where - and now the part wher I have problems -

    Is today between startdate and enddate

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    That's a bit unclear...

    You want the number of rooms booked today... so would that be startdate = today? or do you want startdate AND endate as today?

    OR you want the number of rooms currently booked, meaning that TODAY falls in between startdate and enddate... right?

    so you don't even need startdate here... just end date. Today has to be less than end date.

    Could u be a bit more clear?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    Köln
    Posts
    395
    mendhak,

    Utpal from the VB DB forum answerd the question

    SELECT Count(*) from table where DATE() between Start and End

    Thanks for your help

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    I know, i saw that post.

    I feel so betrayed. *sniff sniff*
    heheh

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