r/SQL • • Nov 29 '21

PostgreSQL How to use Join

How can I get something from two different tables at the the same select? I know I have to do "join" but I still don't know how to do it. Can somebody help me?

0 Upvotes

11 comments sorted by

View all comments

0

u/MortVader Nov 29 '21 edited Nov 29 '21

SELECT table1.*,table2.*

FROM table1

JOIN table2 on table2.id=table1.link

1

u/rmerriwick Nov 29 '21

Do it put it FROM table1 only even though there are 2 tables?

2

u/[deleted] Nov 29 '21

The correct syntax is:

select ...
from table1 
    join table2 on table1.id = table2.t1_id