Como reducir este codigo SQL,
Publicado por Efren (50 intervenciones) el 04/12/2003 19:34:45
select count(Preg2)from TPReguntas where Preg2 = '1-3 meses'
(select count(Preg2)from TPreguntas where Preg2 = '3-6 meses')
(select count(Preg2)from TPreguntas where Preg2 = '6-12 meses')
(select count(Preg2)from TPreguntas where Preg2 = '12-24 meses')
(select count(Preg2)from TPreguntas where Preg2 = '24-36 meses')
(select count(Preg2)from TPreguntas where Preg2 = 'mas de 36 meses')
tal vez en una sola sentencia se haga todo este enredadero.. QUIERO SACAR CUANTAS OPCIONES HAY REPETIDAS EN ESA MISMA COLUMNA, Y LO QUE ESTOY HACIENDO ES CONSULTAR POR SEPARADO... COMO LO HAGO CON UN QUERY MAS CORTO??
(select count(Preg2)from TPreguntas where Preg2 = '3-6 meses')
(select count(Preg2)from TPreguntas where Preg2 = '6-12 meses')
(select count(Preg2)from TPreguntas where Preg2 = '12-24 meses')
(select count(Preg2)from TPreguntas where Preg2 = '24-36 meses')
(select count(Preg2)from TPreguntas where Preg2 = 'mas de 36 meses')
tal vez en una sola sentencia se haga todo este enredadero.. QUIERO SACAR CUANTAS OPCIONES HAY REPETIDAS EN ESA MISMA COLUMNA, Y LO QUE ESTOY HACIENDO ES CONSULTAR POR SEPARADO... COMO LO HAGO CON UN QUERY MAS CORTO??
Valora esta pregunta
0