I have stumped myself with this sql goal.

With this statement I am working with 3 tables
Stats - contains question asked history and if it was answered correcty
  sessionid
  questionid
  correct
Questions - contains a list questions and mul choice answers and answer
  id - pk
  ....
  .....
  etc.
Temp - schema is exactly like questions except contains missed questions
from a previous defined sessionid

What i am trying to do right now is select the questions that have been
asked for the current session (ie 7)
Stats - contains 46 rows with sessionid of 7
Temp - holds 52 missed questions from the previous session (6)

example - this works perfect; it returns 46 results
----------------
SELECT COUNT() FROM Stats S
INNER JOIN Questions T ON S.QuestionId = T.Id
WHERE S.SessionId = 7

but if i do this
----------
SELECT COUNT() FROM Stats S
INNER JOIN Temp T ON S.QuestionId = T.Id
WHERE S.SessionId = 7

51 results are returned? I do not understand why?


My overall goal is to select a random unique question from Temp that has not
been asked (so its not in stats for current session) and ORDER BY Random()
LIMIT 1

Any help would be greatly  appreciated!
-- 
View this message in context: 
http://www.nabble.com/INNER-JOIN%2C-JOIN-Confusin-tp21676221p21676221.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to