A query UNIONs data from two sources. One source returns NULL on a field named TimeTag, while the other source returns Date variables. Sorting the column yields peculiar results: top of the list is the NULLs (that’s what I need and expected), but the date values are sorted in a peculiar order. For example 2/11/2004 appears before 2/5/2004. Here is the SQL of the UNION query:
select * from qryZonePolygonBoundariesWithBreaksBetween where fileID=91 UNION select * from qryCurrentGPSPos ORDER BY polygonID DESC , segmentno, (timetag);
It looks as if the sort is based on the formatted view of the date, rather than the actual date. Yet the qryCurrentGPSPos sorts properly when opened independently. I tried modifiying the query to sort by ORDER BY …., CDate(timetag), but received a syntax error.
Is there a way to force the dates into the proper order in this UNION query?