Results 1 to 3 of 3

Thread: SQL Query

  1. #1
    Fanatic Member
    Join Date
    Aug 07
    Posts
    808

    SQL Query

    i have a table with following columns

    id
    startDate = 25/11/2012
    endDate = 27/11/2012
    timeFrom = 11.5
    timeTo = 12

    date format is DD/MM/YYYY
    and value 11.5 means 11:30
    but we are storing it as 11.5 in database
    like

    9.5
    10.5
    11.5
    12.5
    13.5
    14.5
    15.5

    my problem is, i want one sql query that can take out the records of users who are not available for the given time.

    i have varchar(50) for all the columns

  2. #2
    Hyperactive Member xxarmoxx's Avatar
    Join Date
    Mar 07
    Posts
    365

    Re: SQL Query

    I suggest that you make the tables use the correct data type. It is really bad that you are using varchar for all of them. DB's are designed to work well with dates but if you set the data type to varchar you are basically shooting yourself in the foot. Check the MySQL manual and alter your tables to take dates. Once you do that repost if you have any questions.

  3. #3
    Addicted Member
    Join Date
    Feb 10
    Location
    Damascus - Syria
    Posts
    133

    Re: SQL Query

    As long as you are writing your thread in the PHP forum, then you should learn about these functions in php: (date,time,mktime) then change the varchar to int, this is easier and faster for your operations

Posting Permissions

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