mysql - Select Multiple rows then join for each row -


i have table stores each location user watching. table called usercity , pictured below example row.

enter image description here

i need select rows user_id='1', , retrieve each location_id's record location table, pictured below:

enter image description here

i not sure start here, here's lame attempt:

   select b.* usercity join location b on a.location_id=b.id user_id='1'  

edit query works 1 record. not sure if work multiple rows.

try below-

select a.*, b.*  usercity join location b on a.location_id=b.id user_id=:uid  

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -