sql - Can you use the result of a count in another formula -


select distinct course_no, count(section_id) sections section group course_no having count(section_id) > 3; 

i need use values of count(section_id) determine total capacity mulitiplying each value x capacity each section.

have considered using "with" statement?

;with sampledata  ( select distinct      course_no,      count(section_id) sections      section      group course_no      having count(section_id) > 3 ) select * sampledata 

this allow re-use counts.


Comments