L
L
lexstile2022-03-22 22:35:13
SQL
lexstile, 2022-03-22 22:35:13

How to properly get data through linked table?

There is a table users , it has fields id, vk_user_id ...
There is a table transactions, it has a connection transactions.user_id = users.id .
How to correctly get all transactions of a user, having vk_user_id in hand ?

Tried like this, but I'm clearly doing something wrong:

SELECT transactions.id 
FROM transactions 
LEFT JOIN users ON users.id = transactions.user_id
WHERE users.vk_user_id = 111111

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
ldvo, 2022-03-27
@ldvo

Use INNER JOIN

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question