NYCPHP Meetup

NYPHP.org

[nycphp-talk] [OT] SQL Query

Allen Shaw ashaw at polymerdb.org
Mon Feb 4 12:59:49 EST 2008


Ben Sgro wrote:
> I have a table that includes an id (not unique and a version).
> A unique row is identified by both the id and version. This is for MSSQL.
> I want to select all the id's, but only return the most up to date 
> version.
Hi Ben,

Not sure about MSSQL but I believe the following is standard sql:

select id, max(version) from mytable group by id;

- Allen

-- 
Allen Shaw
slidePresenter (http://slides.sourceforge.net)




More information about the talk mailing list