Subject: need to resolve this.,.
Posted By: razmar78 Post Date: 11/16/2004 2:23:42 PM
error in this query, can someone help me:

SELECT ISNULL(solicitante_dir_ciudad,'DESCONOCIDO'),
COUNT(*) AS [Cantidad_de_Solicitantes],
COUNT(*) * 100.00 / (SELECT COUNT(*) FROM dat_datos_importados) AS [Por Ciento%] FROM dat_datos_importados
WHERE solicitante_dir_ciudad = CASE WHEN @Ciudad='TODOS' THEN solicitante_dir_ciudad ELSE @Ciudad END)
GROUP BY solicitante_dir_ciudad
ORDER BY solicitante_dir_ciudad


Reply By: barmanvarn Reply Date: 11/23/2004 12:35:35 PM
What error message are you getting?
Reply By: barmanvarn Reply Date: 11/23/2004 12:41:24 PM
Looks to me like you just have an extra ')' after you END command.

Try this:
SELECT ISNULL(solicitante_dir_ciudad,'DESCONOCIDO'), COUNT(*) AS [Cantidad_de_Solicitantes],
    COUNT(*) * 100.00 / (SELECT COUNT(*) FROM dat_datos_importados) AS [Por Ciento%]
    FROM dat_datos_importados
    WHERE solicitante_dir_ciudad =
        CASE
            WHEN @Ciudad='TODOS' THEN solicitante_dir_ciudad
            ELSE @Ciudad
        END
    
GROUP BY solicitante_dir_ciudad
ORDER BY solicitante_dir_ciudad

Go to topic 21454

Return to index page 1015
Return to index page 1014
Return to index page 1013
Return to index page 1012
Return to index page 1011
Return to index page 1010
Return to index page 1009
Return to index page 1008
Return to index page 1007
Return to index page 1006