0
I’m using that SELECT, but now I need to search the fields in the client table (ex: cli_clifone
and cli_clicontato
) , how can I include to bring this information into the SELECT below, I’m trying but 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
How did you try? What was the error returned?
– Woss
Wouldn’t just change the first line to
SELECT cli_cdcli, cli_razsoc, cli_clifone, cli_clicontato
?– Victor Stafusa
Query : SELECT cli_cdcli, cli_razsoc, cli_clifone From ( SELECT cli_cdcli, cli_razsoc FROM vw_os_finalizada_cliente Union SELECT ...
Error Code : 1054
Unknown column 'cli_clifone' in 'field list'
– acconsulting Informatica
I can’t because she’s not in the views and I can’t include her in the views !
– acconsulting Informatica
I need to include a SELECT only for the phone and for the customer contact with the SELECT below but I’m not able to fit the syntax.
– acconsulting Informatica
use the views for this is very bad ein... the right would be to run the select straight in the clients table, the way it is will need to make a Join with this to fetch the other fields
– Rovann Linhalis
However I need to have the views because they are specific fields.
– acconsulting Informatica
or you think you need... not even this sub-select and group by are needed...
– Rovann Linhalis
I took this program with this structure, to provide maintenance and requested that I add these fields what Oce suggests to do ?
– acconsulting Informatica
Each case is a case, initially I would eliminate the view... but I can only know what to do, analyzing the specific case... if you want to do only one gambiarra... just put the Join with the client table and search the fields
– Rovann Linhalis
my idea at first was to put a Join to the client table but I’m not able to fit it ?
– acconsulting Informatica
What is the name of this client table and what are the fields there?
– Victor Stafusa
the table is called : client and its fields are: cli_nmcontato, cli_nrdddfn1, cli_fone1, cli_nrdddfn2, cli_fone2, cli_nrdddfn3, cli_fone3, cli_nrdddfax, cli_fax
– acconsulting Informatica
Adds a Join Inner on the outside of everything linking with the client id that comes from the view, and adds the new columns of this new table.
– Andrey Hideki Nakano