Using the Query of the players already selected build a list like : $player_list="player1, player2, player3, ..."; and then use that list to not return selected ones SELECT player_id FROM playerTable WHERE player_id NOT IN($player_list);
I don't know exactly how your tables are, but I hope the above idea will be OK. Thanks Emery ----- Original Message ----- From: "Matt MacLeod" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 26, 2003 11:51 Subject: Excluding Results from a database > Hi, > > I asked for some help about a week ago and thanks to everybody who got > me a little closer to the solution. > > I am developing an online fantasy rugby game. Visitors buy and sell > players and earn points depending on those players' performances in real > matches. > > The only problem I have is that when visitors go to the 'Purchase > Players' screen, I cannot exclude players that they already own. For > example, if they already have Jonny Wilkinson in their team, Wilkinson > is still available to purchase again (anybody familiar with rugby will > appreciate the issue with a visitor fielding a team of 15 Jonny Wilkinsons). > > I am using two queries. The first query selects the players that are > available to buy: > > $teamqry = "SELECT * FROM players, countries WHERE players.position = > '$pos' AND players.country = countries.countryid AND players.price <= > '$availablebudget' ORDER BY players.price DESC"; > > The second brings up the squad that a visitor has currently selected: > > $squadqry = "SELECT * FROM transactions, players, positions, countries > WHERE transactions.managerid = '$userid' AND transactions.playerid = > players.playerid AND players.position = positions.positionid AND > players.country = countries.countryid AND datein < '$now' AND dateout > > '$now' ORDER BY positionid ASC"; > > Basically I need to be able to produce a list of all the players that > appear in the first query ($teamqry) EXCEPT those that appear in the > second ($squadqry). > > Help!?!?!??! > > Thanks very much, > Matt > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]