I would like to know if there's any way I can do a query where I can bring fields that are not in my group by
.
I have the following code:
select sum(TAB_FATURAMENTO.vl_item),CLIENTE.insc_cnpj
from TAB_FATURAMENTO
inner join (IMP_PROCESSO
inner join CLIENTE
on IMP_PROCESSO.cd_cliente = CLIENTE.codigo)
on TAB_FATURAMENTO.cd_processo = IMP_PROCESSO.cd_processo
where TAB_FATURAMENTO.cd_cliente like '%'
and TAB_FATURAMENTO.pg='S'
group by CLIENTE.insc_cnpj
In my select
I would like to bring two more fields, but the grouping I want to be only by the CNPJ of the clients.