SQL: Sort by columns from another table

Asked

Viewed 33 times

0

I have a user tabala, and another with the respective scores, I need to select from the scoreboard only users who live in a certain country.

The country is defended in the users table, each table has a unique id corresponding to each user.

How can I filter the list of scores taking into account the country defined in the user table?

  • Although the description is not clear I deduce that in the table scores you have a field that identifies the user who got such a score. In this case just do a JOIN between these two tables using this user field.

1 answer

1


Without you to inform the table fields it is difficult to assemble a more specific query.
But by the example below I believe you can understand what must be done.

SELECT u.CamposDaTabelaUtilizador, p.CamposDaTabelaPontuacao
  FROM utilizadorers AS u
  INNER JOIN pontuacao as p ON u.IDutilizador = ID.pontuacao;

Browser other questions tagged

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