deepson2 Posted August 4, 2009 Share Posted August 4, 2009 Hello, I want to calculate how many quizes user has not played. basically i have two table. In one table i am storing all question and answer with quizid and the table name is truefalse. In the another table i am storing the quiz information of user has played and table name is quizuser. so i was trying the following query. but this is using left joint. i want to consider userid as well. SELECT * FROM `truefalse`LEFT JOIN quizuserON truefalse.quizid= quizuser.quizidWHERE quizuser.quizid IS NULL Ex- if A is user who has userid=1 And he has played 5 quizes out of 10. so i want to show remaing five quizzes to him. How can i do that. thanks in advance. Link to comment https://forums.phpfreaks.com/topic/168755-solved-select-values-from-table-those-are-not-present-in-the-another-table/ Share on other sites More sharing options...
kickstart Posted August 4, 2009 Share Posted August 4, 2009 Hi Like this:- SELECT * FROM `truefalse` LEFT JOIN quizuser ON truefalse.quizid= quizuser.quizid AND quizuser.userid=1 WHERE quizuser.quizid IS NULL All the best Keith Link to comment https://forums.phpfreaks.com/topic/168755-solved-select-values-from-table-those-are-not-present-in-the-another-table/#findComment-890402 Share on other sites More sharing options...
deepson2 Posted August 4, 2009 Author Share Posted August 4, 2009 Hello Keith, Well, do i need to say that the query is working?? Yes its working. Thanks a lot!! Link to comment https://forums.phpfreaks.com/topic/168755-solved-select-values-from-table-those-are-not-present-in-the-another-table/#findComment-890426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.