Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/03/2012, 10:37
takeo_mahou
 
Fecha de Ingreso: marzo-2012
Mensajes: 2
Antigüedad: 13 años
Puntos: 0
Exclamación Unir Consultas SQl HORizontal

HOla que tal, =)
queria saber si hay alguna manera de unir 3 consultas de manera horizontal
pongo las 3 consultas y sus resultados


------- clientes potenciales -------------------------

select AUXILIAR4,count(g.IDCLIENTE) as total
from teleoperacion t
inner join estadogestion e on t.idgestion=e.idgestion
inner join gestion g on t.idcliente=g.idcliente
where fecha_gestion<'23/03/2012' and e.tipo_rpta='POTENCIALES' and
num_gestion=(select max(num_gestion) from teleoperacion
where idcartera=t.idcartera and idcliente=t.idcliente
and fecha_gestion<'23/03/2012'
group by idcartera,idcliente)
group by AUXILIAR4

--------- clientes negativos -------------------------

select AUXILIAR4,count(g.IDCLIENTE) as total
from teleoperacion t
inner join estadogestion e on t.idgestion=e.idgestion
inner join gestion g on t.idcliente=g.idcliente
where fecha_gestion<'23/03/2012' and e.tipo_rpta='Contactos Negativos' and
num_gestion=(select max(num_gestion) from teleoperacion
where idcartera=t.idcartera and idcliente=t.idcliente
and fecha_gestion<'23/03/2012'
group by idcartera,idcliente)
group by AUXILIAR4

--------- marcaciones -------------------------------

select auxiliar4,count(t.idcliente) as total
from teleoperacion t
inner join gestion g on g.idcliente=t.idcliente
where fecha_gestion<'23/03/2012'
group by auxiliar4


TIPO TOTAL
10 1110
20 154
30 27
40 14
50 27

TIPO TOTAL
10 4654
20 920
30 374
40 234
50 169

TIPO TOTAL
10 39197
20 11959
30 5957
40 3885
50 2951

como veran los campos que uso son de las mismas tablas de las demas consultas
y lo que quiero al final es este resultado



TIPO TOTAL1 TOTAL2 TOTAL3
10 1110 4654 39197
20 154 920 11959
30 27 374 5957
40 14 124 3995
50 27 169 251


espero alguien me pueda ayudar

gracias