I have looked through serveral of the threads here having to do with MySQL UNION queries, but I can't seem to get one to work.
I have several data tables with similar structures. One date column in each is called "TESTDATE". I want to grab all those test dates from all of my tables, sort them (by date) so I can find the earliest and most recent.
I've tried entering the following raw query right in the MySQL monitor:
SELECT TESTDATE FROM DATAIGDIS UNION SELECT TESTDATE FROM DATAMATH ORDER BY TESTDATE;
and always get bupkis, nada, nothin' except
"ERROR 1064: You have an error in your SQL syntax near 'UNION SELECT TESTDATE FROM DATAMATH ORDER BY TESTDATE' at line 1"
I've tried wrapping the select statements in parentheses, including the ORDER BY statement in each select, and various other permutations.
The MySQL version I am running under is 4.3.3
Grrrrr.
Any ideas?
Thanks