Subject RE: [firebird-support] SELECT MIN
Author Mercea Paul
If u have a primary key for this table I would try somtrhing like this:



Select c.Clientid, min(c.date1) MinDate1, (select c1date2 from mytable c1
where c1.pkid=c.pkid ) Date2 from mytable c



Where pkid is your primary key.



Regards

Paul



From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Alejandro Garcia
Sent: Wednesday, April 18, 2007 1:27 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] SELECT MIN



Hi! I have a 3 columns table: CLIENTID DATE1 DATE2
for each CLIENTID can be more than one DATE1 so I have to select the MIN.
Just doing this works fine:
SELECT MIN (DATE1)
from mytable
group by CLIENTID
Now I need also to show DATE2 in the result, if I include it in the SELECT I
need to include it in the GROUP BY but if I do that I don't get the
MIN(DATE1)for each CLIENTID: it returns all of them..

---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]