I'm using this SELECT , but now I need to search the customer table for the fields (eg cli_clifone
and cli_clicontato
), how can I include it to bring this information to SELECT below, I'm trying however only returns me error:
SELECT cli_cdcli, cli_razsoc
From
(
SELECT cli_cdcli, cli_razsoc FROM vw_os_finalizada_cliente
Union
SELECT cli_cdcli, cli_razsoc FROM vw_titrec_aberto_cliente
) AS ConCli
GROUP BY ConCli.cli_cdcli
ORDER BY ConCli.cli_razsoc, ConCli.cli_cdcli