MySQL Forums
Forum List  »  Newbie

Finding like rows based on one of two fields
Posted by: Paul Ille
Date: August 16, 2015 11:39AM

Hi,

I'm having a hard time getting my head around this one for some reason. Maybe I'm tired lol

I have the following table:

CREATE TABLE IF NOT EXISTS `persons_favorite_games` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`person_id` int(11) NOT NULL,
`game_id` int(11) NOT NULL,
`date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`played` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1092 ;

Here's what I want to do.

I want to find game_id in common based on selected persons. For instance, if I select person_id 26 and 92, I want the query to return which game_id they have in common.

This seems simple, but I'm not seeing it.

Eventually I'll have a php array serve as the selection for the person_id.

Any help is much appreciated.

Options: ReplyQuote


Subject
Written By
Posted
Finding like rows based on one of two fields
August 16, 2015 11:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.