faqts : Computers : Databases : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 13 people (77%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

I need to match the max (date) value in the first table to the same date in the second table

Feb 22nd, 2008 20:24
dman, Narendra Jain, Nico Dei Gabbiani, http://sturly.com


As MySQL does not have the nested join available, the only way to do
this is to process the data using a temporary table. This is how you
would do this:
create temporary table a123 (max_date date)
;
insert into a123
select max(date1) from table1
;
select data21, data22, date2
from table2, a123
where date2 = max_date
;