Created
January 20, 2017 19:17
-
-
Save MarioCares/3da2674fc21a429ed72b4f23f5974d69 to your computer and use it in GitHub Desktop.
Cantidad atenciones tipo morbilidad filtro por edad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select a.FECHA_DE_NACIMIENTO, c.FECHA_HORA_INICIO, datediff(yy, a.FECHA_DE_NACIMIENTO, c.FECHA_HORA_INICIO) | |
from CIT_CITA as c | |
inner join USP_USUARIO_APS as a on a.ID = c.USP_ID | |
where TDA_ID in | |
(select ID from TDA_TIPO_DE_ATENCION where nombre = 'MORBILIDAD') | |
and datediff(yy, a.FECHA_DE_NACIMIENTO, c.FECHA_HORA_INICIO) > 9 | |
and datediff(yy, a.FECHA_DE_NACIMIENTO, c.FECHA_HORA_INICIO) < 20 | |
and year(c.FECHA_HORA_INICIO) = 2016 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment