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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -