Ver Mensaje Individual
  #4  
Antiguo 17-12-2004
Avatar de apicito
apicito apicito is offline
Miembro
 
Registrado: may 2003
Ubicación: Ourense
Posts: 341
Reputación: 22
apicito Va por buen camino
Gracias Gydba por tu respuesta.
He probado a utilizarla y no consigo que me funcione. En realidad, el problema que plantee era una abstacción del siguiente:
Donde dije articulos en realidad son asuntos a tratar en una reunión (SESASU_ASUNTO) de tipo Blob, el nombre de los grupos es SESGRU_DESCRIP y es de tipo varchar(80) y el campo de desglose SESGRU_MOSTRAR es boolean. Se trata de listar los asuntos a tratar en la reunión de forma que si en el grupo al que pertenece cada asunto SESGRU_MOSTRAR=1 muestra el titulo del asunto y si es SESGRU_MOSTRAR=0 muestra el nombre del grupo sin repetir nombres de grupo.
He probado con:
Código:
select A.SESASU_SESION,A.SESASU_GRUPO,A.SESASU_ORDEN,
A.SESASU_ASUNTO as ASUNTO,
G.SESGRU_CODIGO,G.SESGRU_MOSTRAR
from SESPLEASU A 
join SESPLEGRU G on G.SESGRU_CODIGO=A.SESASU_GRUPO
where G.SESGRU_MOSTRAR=1
union
select A.SESASU_SESION,A.SESASU_GRUPO,A.SESASU_ORDEN,
G.SESGRU_DESCRIP as ASUNTO,
G.SESGRU_CODIGO,G.SESGRU_MOSTRAR
from SESPLEASU A 
join SESPLEGRU G on G.SESGRU_CODIGO=A.SESASU_GRUPO
where G.SESGRU_MOSTRAR=1
group by A.SESASU_GRUPO
order by A.SESASU_GRUPO,A.SESASU_ORDEN
pero me da un error
Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)
si le hago un cast(G.SESGRU_DESCRIP as blob) as ASUNTO,
me da el mismo error.
Que es lo que está mal?
Responder Con Cita