Subject RE: [firebird-support] Re: help with a select
Author Svein Erling Tysvær
>Thanks Set!! As usual, your suggestion works perfect !!
>May I know what was wrong with my approach?
>-sergio

Well, I can see two things that may not be what you intended by looking at the fields you select:

min(mc.id)
this is OK

min(c.id)
this could be what you perceive to be not all rows, at least there will only be one row for the combination of the fields you do not group by (c.fecha, p.dni, p.apellido || ' ' || p.nombre)

min(d.rubrica_completa)
this will return the lowest value for rubrica_completa, which may be linked to any mc.id, not necessarily the lowest one. If I have a table PERSON containing FIRSTNAME and LASTNAME and the two rows Helen Borrie and Dmitry Yemanov and did SELECT MIN(FIRSTNAME), MIN(LASTNAME) FROM PERSON, I would end up with Dmitry Borrie.

c.fecha,
p.dni,
p.apellido || ' ' || p.nombre
these are ok

HTH,
Set