sbbrown9924
Technical User
Does anyone have a solution to not being able to use aliases in the Where clause of a query? I'm using a calendar function that uses day, month and year fields. The database I'm using has a simple date field, so I've created aliases for day, month and year. Here's what I want to do:
$query = "SELECT event_id, DATE_FORMAT(date,'%e') AS msg_day, DATE_FORMAT(date,%c) AS msg_month, DATE_FORMAT(date,'%Y') AS msg_year,title FROM events2 WHERE
msg_month='" . $this->month_number . "' AND
msg_year='" . $this->year ."' ORDER BY date";
Any help would be most appreciated. Thanks.
$query = "SELECT event_id, DATE_FORMAT(date,'%e') AS msg_day, DATE_FORMAT(date,%c) AS msg_month, DATE_FORMAT(date,'%Y') AS msg_year,title FROM events2 WHERE
msg_month='" . $this->month_number . "' AND
msg_year='" . $this->year ."' ORDER BY date";
Any help would be most appreciated. Thanks.