Ver Mensaje Individual
  #3 (permalink)  
Antiguo 25/10/2008, 12:28
chan
 
Fecha de Ingreso: abril-2005
Mensajes: 182
Antigüedad: 19 años
Puntos: 1
Respuesta: No se como eliminar los duplicados en esta consulta

Hola Cala932, gracias por responder, pero sabes que lo habia intentado antes eso de agrupar por id, pero me tiraba el siguiente error:

Server: Msg 8120, Level 16, State 1, Line 1
Column 'categorias.grupo' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'categorias.nombre' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Server: Msg 8120, Level 16, State 1, Line 1
Column 'locales.id_locales' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

la sentencia que da dicho error es la siguiente:

Código:
select distinct locales.nombre, grupo, categorias.nombre as cat, locales.id_locales from locales join (categlocales join categorias on categorias.id_categorias = categlocales.id_categorias) on locales.id_locales = categlocales.id_locales where grupo = 'Casa' group by locales.id_locales