Querying

I'm still learn on this thing. I have 2 table, table_A (transaction log) and table_B (for references). I want to display a full name based on transaction (like 3rd pic). How can I achieve that? Thank you.
No description
No description
No description
2 Replies
ErickO
ErickO2y ago
SELECT
to_user_id AS to_fullname
from_user_id AS from_fullname
FROM table_A
JOIN table_B AS to_user ON table_A.to_user_id = to_user.user_id
JOIN table_B AS from_user ON table_A.from_user_id = from_user.user_id
SELECT
to_user_id AS to_fullname
from_user_id AS from_fullname
FROM table_A
JOIN table_B AS to_user ON table_A.to_user_id = to_user.user_id
JOIN table_B AS from_user ON table_A.from_user_id = from_user.user_id
that should work I think gotta join the table twice one for each id on the transactions (table_A) table
Asheavenist
AsheavenistOP2y ago
Thanks.. I dunno if JOIN clause can be used like that. It is work an solved ✨
Want results from more Discord servers?
Add your server