Query in SQL Server

Asked

Viewed 80 times

0

When doing the sequinte query

select * FROM conta

It brings me the columns, being that the id_fornecedor comes from the table fornecedor

  id | id_fornecedor | conta_status
  1  |      1        |     S

I would like to bring beyond the id_fornecedor his name too.

  • Which table his name is in ?

  • table name is supplier

  • Insert her structure into the question just like you did in the table account.

1 answer

2


Friend, probably the supplier’s data is in another table, correct?

You can do this by bringing the related data (in this case the vendor name) from that other table.

Let’s imagine that the name of the other table is supplier, okay?

SELECT c.*, f.nome
  FROM conta c
 INNER JOIN fornecedor f ON f.id_fornecedor = c.id_forncedor

If your doubt persists, return with more table details (table name, column names, etc...)

I hope I’ve helped.

  • is as follows: SELECT c.*, f.razao_social FROM account c INNER JOIN provider f ON f.id = c.id_supplied

  • I’m glad it worked out, buddy!

Browser other questions tagged

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