|
-
Jul 19th, 2012, 11:48 PM
#1
Thread Starter
Fanatic Member
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
-
Jul 28th, 2012, 11:31 PM
#2
Hyperactive Member
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.
-
Aug 18th, 2012, 05:51 PM
#3
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|