esiason14 Posted January 29, 2007 Share Posted January 29, 2007 I have two tablesplayers [code] `player_id` smallint(5) unsigned NOT NULL auto_increment, `lname` varchar(50) default NULL, `fname` varchar(50) default NULL, `active` tinyint(1) unsigned default '1', PRIMARY KEY (`player_id`)[/code]AND rosterplayers[code] `player_id` smallint(5) unsigned NOT NULL default '0', `team_id` smallint(5) unsigned default '0', PRIMARY KEY (`player_id`)[/code]Each has a player_id field.What I want to do is retrieve a list of players that are NOT in the rosterplayers table. Make sense. I've tried several ways and it's just not working for me. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
shoz Posted January 29, 2007 Share Posted January 29, 2007 [code]SELECTp.*FROMplayertable AS pLEFT JOINrostertable AS rONp.player_id = r.player_idWHEREr.player_id IS NULL[/code] Quote Link to comment Share on other sites More sharing options...
esiason14 Posted January 30, 2007 Author Share Posted January 30, 2007 Thank you, sir. :) Quote Link to comment Share on other sites More sharing options...
esiason14 Posted January 30, 2007 Author Share Posted January 30, 2007 ...and I just wanted to add. I do know how to spell "query". It was a typo in the title :( Quote Link to comment Share on other sites More sharing options...
artacus Posted January 30, 2007 Share Posted January 30, 2007 Oh, I thought it was French :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.