0
I am having a difficulty in making a select in postgresql, in the select in question, I would like to display the name of distinct cities related to two distinct tables, below follows the DER and the select script I tried to develop, but it didn’t work as expected because it showed the city id’s when you expected to see their name:
-- LISTA DE FRETES REALIZADOS, MOSTRANDO: O NOME DO CLIENTE, A CIDADE DE ORIGEM, CIDADE DE DESTINO, O PRODUTO ENVIADO E O VALOR PAGO PELO FRETE:
SELECT clientes.nome "Nome do Cliente", frete.cidade_origem "Cidade de Origem", end_entrega.cidade_entrega "Cidade de Destino", frete.descricao "Produto", frete.valor "Valor do Frete"
FROM frete INNER JOIN clientes ON frete.idcli = clientes.idcli
INNER JOIN end_entrega ON clientes.idcli = end_entrega.idcli INNER JOIN cidade ON cidade.idcid = frete.cidade_origem
Failed, error: ERROR: schema "clients" does not exist *********Error ************* ERROR: schema "clients" does not exist SQL state: 3F000
– Flavio Lucas Fernandes
please send the script to create the tables with some data for me to test, because in the database template you have above, the client table exists yes.
– Pablo Harger
So Pablo, I did an analysis of the code you sent me to solve the problem and from it I was able to make an adaptation that resulted in the correct resolution of my problem. My thanks.
– Flavio Lucas Fernandes
@Legal flaviolucasfernandes that worked, please signal my response as positive.
– Pablo Harger