"Cnichols" <cnichol...@gmail.com> wrote
in message news:21676221.p...@talk.nabble.com
> 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?

Temp contains duplicate values in Id field. Or else, it's not true that 
Stats contains 46 records with SessionId=7 - confirm by running

SELECT COUNT() FROM Stats S
WHERE S.SessionId = 7;

Igor Tandetnik 



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

Reply via email to