mysql query need help.

Last post 11-02-2009 4:49 AM by preeja.preeja. 3 replies.

Sort Posts:

  • mysql query need help.

    10-11-2009, 5:25 PM
    • Member
      point Member
    • notherand
    • Member since 10-11-2009, 9:21 PM
    • Posts 1

    I doing a simple reservation system and i am trying to figure whats the right query if the room is already booked?.. i only know basic mysql queries . any help would be much appreciated . thank you. here is my DB Table .

  • Re: mysql query need help.

    10-11-2009, 7:50 PM
    • Participant
      804 point Participant
    • andrewjboyd
    • Member since 05-15-2009, 5:26 AM
    • Brisbane, Australia
    • Posts 173

    select * from {tablename} where CheckOut is null or CheckOut <= GETDATE()

    Sorry, I should confirm, MySQL or MSSQL?

    Dont forget to click "Mark as answer" on the post that helped you.

    ================================================
    Why catch a fish to feed someone, when you can teach them to fish and they can feed themselves
  • Re: mysql query need help.

    10-12-2009, 5:36 AM

     pls expln in more detail

  • Re: mysql query need help.

    11-02-2009, 4:49 AM
    • Member
      39 point Member
    • preeja.preeja
    • Member since 10-31-2009, 12:13 AM
    • Kottayam-Kerala
    • Posts 34

    You can use the query given by andrewjboyd;

    select * from <specify your table name here> where CheckOut <= GetDate() or ChechkOut is null

    by which you will get  the details of the room which are not available[already booked], the

    "getdate function will get you the current date."

    think u dont need more explanations.

     

    just do this query to understand getdate () 

    select getdate(), if you want only the datepart then do

      Select convert(varchar, getdate(), 105)

    Preeja P Prabhakar
Page 1 of 1 (4 items)