Ver Mensaje Individual
  #1  
Antiguo 24-08-2022
Avatar de Angel.Matilla
Angel.Matilla Angel.Matilla is offline
Miembro
 
Registrado: ene 2007
Posts: 1.350
Reputación: 19
Angel.Matilla Va por buen camino
¿Se podría con SELECT LIST?

Tengo este query:
Código SQL [-]
SELECT Codigo, SUM(Importe) Cuota, RefInt
  FROM Recibos
 WHERE CAST(Codigo AS BLOB)||'$'||RefInt IN ('167$120180702','983$120191001','1475$120201001','1475$120191226','2660$120201001','2660$120191226'  ,'2660$120181226')
 GROUP BY Codigo, RefInt
que me genera esta salida:
Cita:
CODIGO CUOTA REFINT
167 10 120180702
983 10 120191001
1475 20 120191226
1475 20 120201001
2660 18 120181226
2660 18 120191226
2660 18 120201001
y me interesa que los datos del mismo código salgan en la misma línea:
Cita:
CODIGO CUOTA REFINT
167 10 120180702
983 10 120191001
1475 20 120191226,120201001
2660 18 120181226,120191226,120201001
He probado con SELECT LIST así:
Código SQL [-]
SELECT Codigo, SUM(Importe) Cuota, LIST(RefInt, ',')
  FROM Recibos
 WHERE CAST(Codigo AS BLOB)||'$'||RefInt IN ('167$120180702','983$120191001','1475$120201001','1475$120191226','2660$120201001','2660$120191226'  ,'2660$120181226')
 GROUP BY Codigo, RefInt
pero me da el mismo resultado que el query original. He estado mirando otras preguntas mías con temas similares y no acabo de ver que estoy haciendo mal.
Responder Con Cita