Subject | RE: [firebird-support] SELECT MIN |
---|---|
Author | Alejandro Garcia |
Post date | 2007-04-18T11:16:29Z |
ok thanks ... I understand... sorry
Alan McDonald <alan@...> escribió: > Hi! I have a 3 columns table: CLIENTID DATE1 DATE2
SELECT CLIENTID, MIN(DATE1), MIN(DATE2) FROM MYTABLE
GROUP BY CLIENTID
will do - if you don't want an aggregate/min/sum of a filed then your logic
is faulty.
Which, exactly, DATE2 value would you want adjacent to the clientid when
MIN(DATE1) is returned?
Alan
---------------------------------
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]
Alan McDonald <alan@...> escribió: > Hi! I have a 3 columns table: CLIENTID DATE1 DATE2
> for each CLIENTID can be more than one DATE1 so I have to selectif you want an aggregate/sum of date2 then
> 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..
>
SELECT CLIENTID, MIN(DATE1), MIN(DATE2) FROM MYTABLE
GROUP BY CLIENTID
will do - if you don't want an aggregate/min/sum of a filed then your logic
is faulty.
Which, exactly, DATE2 value would you want adjacent to the clientid when
MIN(DATE1) is returned?
Alan
---------------------------------
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]