Nuno Pereira <[EMAIL PROTECTED]> wrote on 08/05/2005 02:04:35 PM: > Hello list, > > I'm getting the distinct 'params' columns from a table with this query > > SELECT DISTINCT params FROM table; > > but this gets the rows with distinct 'params' cols, but I want to know > from which row each params correspond, like this (which is not correct) > > SELECT id, DISTINCT params FROM table; > > and the query based in a recent post doesn't work > > select distinct on (params), params, id > from table order by params, id > > > I checked the syntax and the later isn't correct. > > Any ideas? > > -- > Nuno Pereira > Estagiário > Carclasse - Comércio Automóveis, S.A. > Lugar Sr. dos Perdões - Ribeirão (Famalicão) > Telf.: 252 330 550 - Tlm: 965 215 076 > email: [EMAIL PROTECTED] > >
Depending on what version server you are running, the GROUP_CONCAT() function may be an option for you: SELECT params, GROUP_CONCAT(ID) FROM table GROUP BY params; Shawn Green Database Administrator Unimin Corporation - Spruce Pine