Jump to content

Complicated Query...


Andy Booth

Recommended Posts

Ok, i'll try explain this the best way I can.......

SELECT users.user_name, games.game_name, games.game_console, offer.game1_id, offer.game2_id, offer.game3_id, offer.game4_id, offer.game5_id, offer.all_games, offer.secure, offer.status, owned.game_id, owned.master_id FROM users, games, offer, owned WHERE (users.master_id = '2') AND (offer.user_id = '2') AND (owned.game_id = games.game_id).

The 'owned.master_id' has a different value to the value I have specified as being '2' for the users.master_id. The thing is, I want to get the username (from the users table) for the member whos master id is owned.master_id. Can I do this all in one query? I want it along with everything else i've already successfully retrieved..

Thanks :)
Link to comment
https://forums.phpfreaks.com/topic/35361-complicated-query/
Share on other sites

I'm not sure what you mean exactly...so i'll try explain the whole situation...

I want a query that will do the following.

Retrieve records from a table called offer. I want to retrieve games.game_name and games.game_console using the offer.game_id which links to games.game_id. From the offer table also contains the master_id of the member the offer is being offered to. I want to get the user_name of that master_id which can be found in the users table.

Does this help? :)
Link to comment
https://forums.phpfreaks.com/topic/35361-complicated-query/#findComment-168104
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.