dug Posted August 29, 2006 Share Posted August 29, 2006 Hi folks,is the below query correct? retrieve all courses in the past that have a name that starts with CertSELECT c.ID AS 'Course ID',date_format(c.start_date,'%d/%m/%Y') AS 'Start Date',date_format(c.end_date,'%d/%m/%Y') AS 'End Date' ,t.description AS 'Course Description',FROM media_courses AS cINNER JOIN media_courses_type AS tON t.ID = c.media_courses_type_IDWHERE c.end_date < NOW()AND t.description LIKE 'Cert%'ORDER BY c.start_date ASCThanksdug Quote Link to comment https://forums.phpfreaks.com/topic/19032-like-operator/ Share on other sites More sharing options...
fenway Posted August 29, 2006 Share Posted August 29, 2006 Looks fine to me... but you should have kept this post in the original thread. Quote Link to comment https://forums.phpfreaks.com/topic/19032-like-operator/#findComment-82304 Share on other sites More sharing options...
dug Posted August 29, 2006 Author Share Posted August 29, 2006 thanks fenway. sorry for re-posting. while you here on the initial post for this question:Re-write the query to return all courses that are more than 1 day in lengthyou said i should subtract start and end date, is this what you meant?SELECT c.ID AS 'Course ID',date_format(c.start_date,'%d/%m/%Y') AS 'Start Date',date_format(c.end_date,'%d/%m/%Y') AS 'End Date' ,t.description AS 'Course Description',FROM media_courses AS cINNER JOIN media_courses_type AS t ON t.ID = c.media_courses_type_ID[b]WHERE c.start_date – c.end_date[/b]ORDER BY c.start_date ASC Quote Link to comment https://forums.phpfreaks.com/topic/19032-like-operator/#findComment-82308 Share on other sites More sharing options...
fenway Posted August 29, 2006 Share Posted August 29, 2006 No... check out the TO_DAYS() function. Quote Link to comment https://forums.phpfreaks.com/topic/19032-like-operator/#findComment-82346 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.