Last active
September 23, 2015 15:10
-
-
Save jesuslerma/6726c21c8ddc2d1710b1 to your computer and use it in GitHub Desktop.
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 conciliaciones.id AS id, st.id AS st_id, st.fecha, f.folio, | |
cuenta.numero_cuenta || '-' || cuenta.nombre AS nombre_cuenta, | |
(@ conciliaciones.dactual - conciliaciones.danterior) AS monto | |
FROM conciliaciones | |
INNER JOIN status_accounts st ON st.id = conciliaciones.status_account_id | |
LEFT JOIN facturas f ON f.id = conciliaciones.factura_id | |
LEFT JOIN ( | |
SELECT concepto_contables.* FROM concepto_contables | |
LEFT JOIN concepto_contable_diots | |
ON concepto_contable_diots.concepto_contable_id = concepto_contables.id | |
) concepto | |
ON concepto.id = conciliaciones.concepto_contable_id | |
LEFT JOIN cat_empresas cat_e ON cat_e.id = concepto.cat_empresa_id | |
LEFT JOIN cuenta_contables cuenta | |
ON cat_e.cuenta_contable_id = cuenta.id | |
WHERE st.fecha >= '2015-03-01' AND st.fecha <= '2015-03-31' AND conciliaciones.empresa_rfc = 'TEG080425R58' AND conciliaciones.status_account_id IS NOT NULL AND st.retiro > 0.0 | |
AND NOT EXISTS ( | |
SELECT conciliacione_id FROM diots WHERE conciliacione_id = conciliaciones.id | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment