sql - How to select all the offers a user earned? -


i trying select offers user have earned. however, cannot figure how it.

i have 3 tables

user: id | name offer: id | name user_offer: id | user_id | offer_id 

how select offer user 1 has?

this should work:

select offer.name  offer inner join user_offer  on user_offer.offer_id=offer.id  user_offer.user_id='1' 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -