Siggles Posted January 22, 2008 Share Posted January 22, 2008 I have a select statement.... "SELECT fixtures.opponent, fixtures.resultus, fixtures.resultthem, predictions.resultus1, predictions.resultthem1 FROM predictions Inner Join fixtures ON fixtures.id = predictions.id AND predictions.username = '$session->username'" The fixtures table holds the details of the individual football fixtures and the result of the fixture. The predictions table holds the data of individual preidcitons made by users. There is a third table, users. Fixtures and predictions tables are referenced by the id column which is in each table. If a prediction is made, it will be given an id that will link it to the fixture id. If I use the above select statement using = for the ON bit it works fine and returns only fixtures where the user has made a prediction. I f I exchange that for <> it shows all the other fixtures where he has not made a prediction but puts the prediction from the other game into all rows. Opponent Score Your prediction Eg = West Ham 1 -0 2-0 Eg <> Opponent Score Your Prediction Chelsea 2-0 2-0 * Arsenal 3-1 2-0 * *Basically takes this from the other result. Can you help? Hope that made sense. Quote Link to comment https://forums.phpfreaks.com/topic/87225-select-statement/ Share on other sites More sharing options...
beebum Posted January 22, 2008 Share Posted January 22, 2008 I think you want to change the "AND" to "WHERE" Quote Link to comment https://forums.phpfreaks.com/topic/87225-select-statement/#findComment-446287 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.