我有这个代码:
select
B.plc_nomeConta, B.plc_classificador, B.plc_id,
A.cap_idPlanoContasFin, SUM(A.cap_valorfatura) as Total
from
tbl_PlanoFinanceiro B
left outer join erp_contaspagar A on B.plc_id = A.cap_idPlanoContasFin
/* where A.cap_idEmpresa like 2*/
group by
B.plc_nomeConta,
B.plc_classificador,
B.plc_id,
A.cap_idPlanoContasFin
此代码返回 185 行,
(-) COFINS 10.01.01.01.004 330 330 971090,97
(-) ICMS 10.01.01.01.002 328 328 1378407,11
(-) IMPOSTOS 10.01.00.00.000 324 NULL NULL
(-) IMPOSTOS 10.01.01.00.000 325 NULL NULL
(-) IMPOSTOS 10.01.01.01.000 326 NULL NULL
(-) ISS 10.01.01.01.001 327 327 1000960,59
(-) PIS 10.01.01.01.003 329 329 240600,27
但是当我取消注释时where /* where A.cap_idEmpresa like 2*/
,只返回 A.cap_idPlanoContasFin is not null
, In needB.plc_nomeConta, B.plc_classificador, B.plc_id
出现的行。