Darno7 Posted March 21, 2009 Share Posted March 21, 2009 I've been having problems with a query for a while, I think the solution is simple enough so I'm not sure if I even need to post it. The logic behind it is I have a part of my site that shows you the list of games a certain user can play. Teams decide to play each other, and then the players of each team sign up. So the query to post the list of games the user is attached to, is working fine... but I'm having trouble finding the games the user isn't attached to but can play. WHERE (proposedgame.userID="4") AND (proposedgameattached.teamID="3"); ---> This gives me the list of games where the user is on said team and is available for the game. The problem is if I simply negate the userID <>"4" to find out what games the user isn't attached to but can play , I'll be giving a list of games that is tainted with other users data. I hope this is detailed enough, I know it's probably simple but it's driving me mad. Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/ Share on other sites More sharing options...
Darno7 Posted March 23, 2009 Author Share Posted March 23, 2009 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/#findComment-791408 Share on other sites More sharing options...
Darno7 Posted March 23, 2009 Author Share Posted March 23, 2009 Anyone able to help with this? Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/#findComment-791409 Share on other sites More sharing options...
fenway Posted March 27, 2009 Share Posted March 27, 2009 I don't understand, sorry. Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/#findComment-795277 Share on other sites More sharing options...
Darno7 Posted March 27, 2009 Author Share Posted March 27, 2009 It's grand I figured it out with a couple of sub queries.. Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/#findComment-795283 Share on other sites More sharing options...
fenway Posted April 1, 2009 Share Posted April 1, 2009 It's grand I figured it out with a couple of sub queries.. Then post the solution. Quote Link to comment https://forums.phpfreaks.com/topic/150456-troublesome-query/#findComment-798560 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.