Reputation: 15269
Its a little bit complicated, but I will try to explain as best as I can.
I got 3 tables with news data, every table as a 'date' column that contains an unix time of the posted news.
Now select all of 'date' (from 3 tables) as get the min. value of the year using PHP date: (date('Y', $year)
).
More informations:
Table1(Table2, Table3) -> has some 'date' column.
Now I need to withdraw those date
fields (for example) into array, so the array will look like this: array('1323433261', '1323424614', '1322454677', ...etc);
and then select the min. value in the array.
Hope you understand what I'm trying to reach, in case if you don't, please comment.
Upvotes: 1
Views: 152
Reputation: 3181
Try this
SELECT MIN(min) FROM (
(SELECT YEAR(FROM_UNIXTIME(MIN(add_date))) as min FROM table1)
UNION
(SELECT YEAR(FROM_UNIXTIME(MIN(add_date))) as min FROM table2)
UNION
(SELECT YEAR(FROM_UNIXTIME(MIN(add_date))) as min FROM table3)
) as t
Upvotes: 4