|
looking for some help here as i am getting frustrated, I have a table that has a few relational database. Lets say the head table is called person, each person can have multiple tests, and each one of those tests can have multiple questions. What i want to check is that each person has filled has at least one entry in the test table and that there is at least on entry in the questions table for a test. I just need to know has a person filled out at least on test and there are questions tied to a test that they have filled out.
(comments are locked)
|
|
Can you tell us a bit about the tables? The relationship between them. As many details as you can give will help us greatly. so table person is just your basic table it has an auto num which we will call person id, name ect ect. Table Tests joins on the person table with a fk of person id. it also has a auto generated "test id" as its pk. Questions joins on test via a fk with Test ID. I can provide actual structure if needed
May 26 '11 at 04:44 PM
klandathu
SELECT DISTINCT P.person_id, count(t.person_id), count(q.test_id)
May 26 '11 at 04:51 PM
Tim
that would work but i am doing some case statements and logic in the select statement that i dont think i can group by. i could possible rewrite the sp to insert those values into a temp table and then join. is there a way to do this withouth grouping?
May 26 '11 at 05:00 PM
klandathu
Can you paste your code? That would help me help you.
May 26 '11 at 05:02 PM
Tim
@TRAD without reading the comments, I was thinking, you may be the first to have answered a question with a question--and it being accepted! :)
May 26 '11 at 09:03 PM
Scot Hauder
(comments are locked)
|

