Beginner's SQL question
Hi everyone,
I have not been in touch with SQL for a long time. I had to start using it again since a few weeks and it has been quite a struggle.
I have a question and I would be really grateful if someone can help me with it. Consider the following table structure:
ID TESTNUMBER STATE VALUE
1 100 1 0
2 100 1 1
3 100 2 1
4 100 2 0
5 101 1 1
6 101 1 0
7 101 2 1
Now, what I want to do is get the DISTINCZ count of TESTNUMBER, say where
(State = 1, Value = 0) and (State = 2, Value = 1).
So basically this should give me a count of 2 because TestNumber 100 has an entry for (State = 1, Value = 0) and (State = 2, Value = 1).
Also, entry 101 has (State = 1, Value = 0) and (State = 2, Value = 1)
entries. However, I am unable to write this using a query. Please help!
Thanks,
Sincerely,
Pankaj
|