Hi.. I'm trying to extract the day, month, and year from a datetime to use it within a 'WHERE' statement.
Table: workshops
workshopid - int(10)
workshopgroupcoursecode - text
title - varchar(255)
description - text
Table: workshops
workshopscheduleid - int(10)
workshopid - int(10)
startdatetime - datetime
enddatetime - datetime
timedescription - text
Query:
SELECT workshops.workshopid, EXTRACT(DAY FROM workshopschedules.startdatetime) as d, workshops.title,
FROM workshopschedules, workshops
WHERE Month(workshopschedules.startdatetime) = '$month' AND Year(workshopschedules.startdatetime) = '$year'";
****You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM workshopschedules, workshops WHERE Month(workshopsched
does mysql not allow me to extract the day and month and use it in a WHERE condition??