Re: do I need 2 selects?

2007-05-25 Thread Reinhardt Christiansen
- Original Message - From: "James Lockie" <[EMAIL PROTECTED]> To: "MySQL Mailing List" Sent: Friday, May 25, 2007 3:11 PM Subject: do I need 2 selects? Say I have x rows of 2 columns each. For example, 2 rows: 'A 10:00pm' and 'A 11:00pm

Re: do I need 2 selects?

2007-05-25 Thread Baron Schwartz
Hi James, James Lockie wrote: Say I have x rows of 2 columns each. For example, 2 rows: 'A 10:00pm' and 'A 11:00pm'. I want to return one 'A' row with the latest time (eg. 'A 11:00pm). I could do 'select distinct(col1) from table' and then 'select col1, max( col2 ) where col1=row[0]'? Is the

Re: do I need 2 selects?

2007-05-25 Thread Joerg Bruehe
Hi James, all! James Lockie wrote: Say I have x rows of 2 columns each. For example, 2 rows: 'A 10:00pm' and 'A 11:00pm'. I want to return one 'A' row with the latest time (eg. 'A 11:00pm). I could do 'select distinct(col1) from table' and then 'select col1, max( col2 ) where col1=row[0]'?

Re: do I need 2 selects?

2007-05-25 Thread James Lockie
Baron Schwartz wrote: Hi James, James Lockie wrote: Say I have x rows of 2 columns each. For example, 2 rows: 'A 10:00pm' and 'A 11:00pm'. I want to return one 'A' row with the latest time (eg. 'A 11:00pm). I could do 'select distinct(col1) from table' and then 'select col1, max( col2 ) wher

do I need 2 selects?

2007-05-25 Thread James Lockie
Say I have x rows of 2 columns each. For example, 2 rows: 'A 10:00pm' and 'A 11:00pm'. I want to return one 'A' row with the latest time (eg. 'A 11:00pm). I could do 'select distinct(col1) from table' and then 'select col1, max( col2 ) where col1=row[0]'? Is there a way to do it in one select?