aliashippysmom
Programmer
Hi! I can't seem to figure this out. I have five tables that contain a dateUpdated field. I need to find the maximum value of this field for all five tables. I want to execute a query which returns one value, the maximum date of all the dateUpdated fields.
I've tried things like this:
Can anyone see what's wrong with this? It does not work. (I get a syntax error.) Thanks in advance.
I've tried things like this:
Code:
select max(dateUpdated) from
(
select max(dateUpdated) as the_date
from table1
UNION
select max(dateUpdated) as the_date
from table2
UNION
select max(dateUpdated) as the_date
from table3
UNION
select max(dateUpdated) as the_date
from table4
UNION
select max(dateUpdated) as the_date
from table5)
Can anyone see what's wrong with this? It does not work. (I get a syntax error.) Thanks in advance.