Hi, I have two tables: players and cards2
In each cards2 row, there is at least one player id (pid, pid2, pid3, pid4). I'm trying to come up with a select statement to get all fname's and lname's if there is more than one player id (pid's that are not 0). There is always a pid, but not always a pid2, pid3, etc. Does this make sense?
Here are the structures.
Players table
CREATE TABLE IF NOT EXISTS `players` (
`player_id` mediumint(10) NOT NULL AUTO_INCREMENT,
`sport_id` tinyint(4) NOT NULL,
`fname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`lname` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`hof` tinyint(4) NOT NULL,
PRIMARY KEY (`player_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=421 ;
Cards2 table
CREATE TABLE IF NOT EXISTS `cards2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` mediumint(10) NOT NULL,
`pid2` mediumint(10) NOT NULL,
`pid3` mediumint(10) NOT NULL,
`pid4` mediumint(10) NOT NULL,
`num` smallint(4) NOT NULL DEFAULT '0',
`year` year(4) NOT NULL DEFAULT '0000',
`notes` text,
`new_manuf` varchar(50) NOT NULL,
`sportid` tinyint(4) NOT NULL DEFAULT '0',
`fname` varchar(25) NOT NULL,
`lname` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=572 ;
Thanks in advance!