Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Mysql question
- Bob Bedford
May 23, 2005, 2:44 pm
rate this thread
I haven't access to Mysql NG, so let me ask here.
select distinct a,b from a left join b on a.id = b.id
id datefrom dateto
1 2005-01-01 2005-01-15
2 2005-01-02 2005-01-16
1 2005-01-17 2005-01-31
In my case, I'd like to show the last date for any ID.
So the result:
How to do so ? In my case, I get two rows for ID 1
Must I run 2 queries ? It's really hard to create a query with GroupBy, as
the real query takes 20 fields
Re: Mysql question
*** Bob Bedford wrote/escribió (Mon, 23 May 2005 09:44:28 +0200):
Then you don't need datefrom and dateto but MAX(datefrom) and MAX(dateto)
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group