Re: finding the latest date + start with DB first?


#1

this combines the two into one sql query (assuming the db you are using
can handle subselects):

SELECT products.name, builds.version, builds.install_date
FROM builds
INNER JOIN products ON builds.product_id = products.id,
(SELECT builds.product_id, MAX(builds.install_date) AS dt
FROM builds
GROUP BY 1) AS x
WHERE builds.product_id = x.product_id
AND builds.install_date = x.dt

[This was tested on MySQL 4.1.12]