Ver Mensaje Individual
  #10  
Antiguo 13-07-2012
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Reputación: 24
guillotmarc Va por buen camino
Hola Josep.

Cita:
Empezado por jafera Ver Mensaje
A ver si avanzo algo he hecho esto y me salen los datos correctos:
Código SQL [-]
select ID_REBUT, ID_ARBIT1 
from RE0010DG 
        INNER JOIN RE0001 ON ID_ARBIT1 = 1 
GROUP BY ID_ARBIT1, ID_REBUT


Pero solo para una de las columnas de la tabla, ID_ARBIT1, puedo añadir más INNER o algo para que me busque en las otra siete columnas?

Tengo que hacer un select para cada una?.

Estoy más liado que la pata un romano.

Gracias

Josep
Para añadir las otras siete columnas puedes usar la cláusula UNION, que permite unir varias consultas en una sola.

Es decir :

Código SQL [-]
  select id_arbit1, id_rebut, import_1, sobres_1, import_km_1, campionat1, feiner1, dos_sectors1, total_a1 from re0010dg
  where id_arbit1 = 1
UNION
  select id_arbit2, id_rebut, import_2, sobres_2, import_km_2, campionat2, feiner2, dos_sectors2, total_a2 from re0010dg
  where id_arbit2 = 1
UNION
  select id_arbit3, id_rebut, import_3, sobres_3, import_km_3, campionat3, feiner3, dos_sectors3, total_a3 from re0010dg
  where id_arbit3 = 1
UNION
  select id_arbit4, id_rebut, import_4, sobres_4, import_km_4, campionat4, feiner4, dos_sectors4, total_a4 from re0010dg
  where id_arbit4 = 1
UNION
  select id_arbit5, id_rebut, import_5, sobres_5, import_km_5, campionat5, feiner5, dos_sectors5, total_a5 from re0010dg
  where id_arbit5 = 1
UNION
  select id_arbit6, id_rebut, import_6, sobres_6, import_km_6, campionat6, feiner6, dos_sectors6, total_a6 from re0010dg
  where id_arbit6 = 1
UNION
  select id_arbit7, id_rebut, import_7, sobres_7, import_km_7, campionat7, feiner7, dos_sectors7, total_a7 from re0010dg
  where id_arbit7 = 1
UNION
  select id_arbit8, id_rebut, import_8, sobres_8, import_km_8, campionat8, feiner8, dos_sectors8, total_a8 from re0010dg
  where id_arbit8 = 1

Salut
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).
Responder Con Cita