i think this is what you're looking for...
Code:
SELECT con.name
, con.con_id
, con.constat
, part.pardate
, part.other_columns
FROM con
INNER
JOIN ( SELECT con_id
, MAX(pardate) AS max_pardate
FROM part
GROUP
BY con_id ) AS m
ON m.con_id = con.con_id
INNER
JOIN part
ON part.con_id = m.con_id
AND part.pardate = m.max_pardate
it's the other_columns that makes this a challenging problem
this is usually called the "row having the groupwise max" -- in other words, your con_id is the grouping column, MAX(pardate) determines the latest row, and then you must join back to the part table to get the other columns
see also this recent thread which had the same problem
Bookmarks