|
Posted by David Portas on 10/01/95 11:17
For example, try this:
CREATE TABLE Survey (group_no INTEGER NOT NULL REFERENCES Groups (group_no),
year_no INTEGER NOT NULL, answer_no INTEGER NOT NULL CHECK (answer_no
BETWEEN 1 AND 40), response INTEGER NOT NULL CHECK (response BETWEEN 1 AND
4), PRIMARY KEY (group_no, year_no, answer_no))
SELECT response, COUNT(*)
FROM Survey
WHERE group_no = @group_no
AND year_no = @year_no
GROUP BY response
--
David Portas
SQL Server MVP
--
[Back to original message]
|