Reputation: 468
I have a column called 'Measure', which contains multiple values. When the value of this columns is 'Majors', I want to execute the following:
select *
from students;
And when the value is anything else, I want to execute:
select distinct *
from students;
I have used CASE statements in the past to return a single value. How can they be made to return an entire query? Alternatively, how can this problem be approached without CASE?
Any help is appreciated.
Upvotes: 0
Views: 294
Reputation: 371
I'd give a try at this. Basicly, it gives you all the results for Majors and then adds up the other results.
SELECT * FROM students
WHERE Measure = 'Majors'
UNION
SELECT DISTINCT * FROM students
WHERE Measure <> 'Majors'
Upvotes: 2