Select some data from different tables

Asked

Viewed 27 times

0

Reborn the programmer around here, I’m having trouble with SQL and ask for help.

I have two tables called orcamentos and clientes.

I need to select all fields in the table orcamentos and only the countryside nome table clientes when the condition orcamentos.id_cliente = clientes.id.

I used up to the moment as follows:

SELECT * FROM orcamentos tab1
INNER JOIN clientes tab2 ON (tab1.id_cliente = tab2.id)

Works, but returns all fields of the client table...

1 answer

2


Just specify the fields you want:

SELECT tab1.*, tab2.nome FROM orcamentos tab1
INNER JOIN clientes tab2 ON (tab1.id_cliente = tab2.id)

Examples of SELECT (Transact-SQL)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.