22 lines
447 B
SQL
22 lines
447 B
SQL
SELECT '1001' AS 'formato','5007' AS 'concepto',nit,proveedor,sum( movimiento )
|
|
FROM compras
|
|
WHERE
|
|
(
|
|
codCuenta = "14350101"
|
|
AND
|
|
tipo REGEXP "([12358]V|AP|DG|FP|FT|CC)"
|
|
)
|
|
OR (
|
|
codCuenta = "14350102"
|
|
AND
|
|
tipo REGEXP "(AP|DG|FP|FT)"
|
|
)
|
|
OR (
|
|
codCuenta = "14350201"
|
|
AND
|
|
tipo REGEXP "(CC)"
|
|
)
|
|
AND (length(nit) > 3)
|
|
AND nit NOT LIKE "444444%"
|
|
GROUP BY nit
|