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

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -