Created
November 18, 2014 13:41
-
-
Save MarioCares/a289a173d41a9d4ac4d3 to your computer and use it in GitHub Desktop.
Entrega listado de productos despachados desde Farmacia.
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 ARTI_ID, DESCRIPCION_ARTICULO, SUM(CAST(CANTIDAD_DESPACHADA AS numeric)) as despachado, | |
month(RCTA_RECETA.FECHA_GENERACION) as mes | |
from IquiqueCom.dbo.PRES_PRESCRIPCION inner join IquiqueCom.dbo.RCTA_RECETA | |
on RCTA_RECETA.ID = PRES_PRESCRIPCION.RCTA_ID | |
where IquiqueCom.dbo.PRES_PRESCRIPCION.ARTI_ID in( | |
select id from IquiqueCom.dbo.ARTI_ARTICULO | |
where IquiqueCom.dbo.ARTI_ARTICULO.ARTI_ID IS NOT NULL) and | |
pres_prescripcion.RCTA_ID in( | |
select ID from IquiqueCom.dbo.RCTA_RECETA | |
where YEAR(fecha_generacion) = 2014 | |
and NOD_ID = 2957 | |
) group by ARTI_ID, DESCRIPCION_ARTICULO, MONTH(rcta_receta.fecha_generacion) | |
order by DESCRIPCION_ARTICULO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment