mysql - JOINING more then once? -
i have table of users:users
have table booths
users =============================== id | name | sid ------------------------------- 1 cillia abcd 2 ted efgh booth ===================================================== booth_id | booth_owner | booth_manager ----------------------------------------------------- 1 1 2 2 2 4 3 1 3
i create query make clear specific booth, name of manager , name of owner.
best approach that?
you link users
table booth
table twice:
select b.booth_id, s1.name boothowner, s2.name boothmanager booth b inner join users s1 on b.booth_owner = s1.id inner join users s2 on b.booth_manager = s2.id
Comments
Post a Comment