Re: [nyphp-talk] [OT] SQL Query

2008-02-04 Thread Ben Sgro
Hello, Thanks to all. I was doing this for the individual id selection, and it just appeared that it wouldn't work for all id's. I should have just tried it before asking. Thanks again, - Ben Allen Shaw wrote: Ben Sgro wrote: I have a table that includes an id (not unique and a version). A

Re: [nyphp-talk] [OT] SQL Query

2008-02-04 Thread Allen Shaw
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 stand

Re: [nyphp-talk] [OT] SQL Query

2008-02-04 Thread drydell
select id, max(version) from table group by id- Original Message -From: Ben Sgro Date: Monday, February 4, 2008 12:33 pmSubject: [nyphp-talk] [OT] SQL QueryTo: NYPHP Talk > Hello All,> > I have a table that includes an id (not unique and a version).> > A unique row is identified by both

Re: [nyphp-talk] [OT] SQL Query

2008-02-04 Thread Dan Cech
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. So, for a table id | version - 1 | 0 1 | 1 2 | 0 2 |

[nyphp-talk] [OT] SQL Query

2008-02-04 Thread Ben Sgro
Hello All, 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. So, for a table id | version - 1 | 0 1 | 1 2 | 0 2 | 1 2