mysql - Join city_name for users and for an event -


i trying city name event , city name user lives. both have postalcode, corresponds city_name in table cities.

my query far:

select     meetups.meetup_name,     meetups.meetup_text,     users.username,     cities.city_name     meetups, users, cities     meetups.url_meetup = ? , users.id = meetups.author_id , cities.postalcode = meetups.postalcode 

what still need city name user.

my tables looks follows:

meetups =>     id     meetup_url     meetup_name     meetup_text     author_id     postalcode  users =>     id     username     postalcode  cities =>     postalcode     city_name 

select     meetups.meetup_name,     meetups.url_meetup,     meetups.meetup_text,     users.username,     c1.city_name meetup_city,     c2.city_name user_city    meetups, users, cities c1, cities c2    url_meetup = ?  , users.id = meetups.author_id  , c1.postalcode = meetups.postalcode , c2.postalcode = users.postalcode 

this should u name of user city well.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -