
13/12/2007, 07:43
|
 | | | Fecha de Ingreso: octubre-2000 Ubicación: Dentro de mi cabeza. ono?
Mensajes: 1.264
Antigüedad: 24 años, 4 meses Puntos: 3 | |
Re: Como hacer un Count de varios select? ahh,prueba mejor entonces con:
(al hacer el union tal vez junta los registros iguales)
select sum(cuenta) as alias from (
SELECT '1' as marca, count(*) as cuenta
FROM ab
INNER JOIN filtros ON ab.cod_sitio = filtros.valor_filtro
AND (
filtros.idpersona = '1'
)
AND (
filtros.nom_filtro = 'sitio'
)
UNION SELECT '2' as marca, count(*) as cuenta
FROM ab
INNER JOIN filtros ON ab.fase = filtros.valor_filtro
AND (
filtros.idpersona = '1'
)
AND (
filtros.nom_filtro = 'sitio'
)
UNION SELECT '3' as marca, count(*) as cuenta
FROM ab
INNER JOIN filtros ON ab.zona = filtros.valor_filtro
AND (
filtros.idpersona = '1'
)
AND (
filtros.nom_filtro = 'sitio'
)
)
Lo otro que te decia es hacer algo como
select $variable1= (select count(*) from etc, etc)
select $variable1 += (select count(*) from etc, etc)
select $variable1 += (select count(*) from etc, etc)
select $variable1
pero no se coo anda lo de las variables en my sql, de cualquier forma lo primero debería funcionar..
Slaudosss
__________________ |||| ))>_<(( |||| www.webmagic.cl <-- esta pagina está mala, no la busquen |