select DISTINCT A.CFOP, A.CST_PIS, C.participapiscofins from produtos_NOTASAIDA A inner join CFOP C on A.cfop = C.CFOP inner join lvsaidas B on A.primaria = B.primaria where A.cst_pis = 49 and B.emissao between('2013-02-01') and ('2013-02-28') select DISTINCT A.CFOP, A.CST_PIS, C.participapiscofins, B.NOTA, A.ID_PRODUTO from produtos_NOTASAIDA A inner join CFOP C on A.cfop = C.CFOP inner join lvsaidas B on A.primaria = B.primaria where A.cst_pis = 06 and B.emissao between('2011-01-01') and ('2011-01-31') group by B.NOTA