NogDog;10883367 wrote:I believe you need to prepend the table name to the column name within the DATE_FORMAT() functions (rather than prepending it to the function name):
DATE_FORMAT(mcevents.start_date, '%b %3')
That kind of makes sense, lol. I got it to work, but only by taking out the "WHERE". I've tried several different methods and I am unable to get it to work with the WHERE statement in there.
$query = "SELECT DATE_FORMAT(mcevents.start_date, '%b %e'), DATE_FORMAT(mcevents.end_date, '%b %e'), mcevents.title, mcevents.city, mcevents.state, mcevents.state_name, mcevents.url, mcevents.type,
DATE_FORMAT(4wevents.start_date, '%b %e'), DATE_FORMAT(4wevents.end_date, '%b %e'), 4wevents.title, 4wevents.city, 4wevents.state, 4wevents.state_name, 4wevents.url, 4wevents.type
FROM mcevents, 4wevents
WHERE mcevents.start_date between '$today' AND '$year_out', 4wevents.start_date between '$today' AND '$year_out'
ORDER BY mcevents.start_date, mcevents.state, mcevents.type, mcevents.city,
4wevents.start_date, 4wevents.state, 4wevents.type, 4wevents.city
LIMIT $offset, $rowsPerPage";
If I do the following I get an Erorr:
WHERE mcevents.end_date between '$today' AND '$year_out', 4wevents.end_date between '$today' AND '$year_out'
However if I change it to this I don't get an error. But I also do no bet any of the 4wevents AND the mcevents are duplicated during the between dates.
WHERE mcevents.end_date between '$today' AND '$year_out' OR 4wevents.end_date between '$today' AND '$year_out'