php - MySQL finding rows in one table with information from another -


currently, have 2 mysql tables.

first table stores relation between friend , picture.

table 1

 id | pic_id | friend_id ---------------------------- 0 | 123 | 84589 1 | 290 | 11390 2 | 884 | 84589 

table 2

second table stores more information pic...

id | pic_id | title | color | detail ---------------------------------------------- 0 | 123 | hello | black | brush 1 | 124 | world | red | paint 2 | 884 | sample | green | star 

i have friend_id , need grab pic_id table 1 , use pic_id grab columns table 2(title, color, detail)...

how in mysql?

thank you!

simply join 2 tables.

select b.title, b.color, b.detail table1 inner join table2 b on a.pic_id = b.pic_id friend_id = 84589 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -