Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT t3.cid, t3.section, (t2.numberA / t3.allStuds) as ‘%A’
- FROM (SELECT cid, section, sum(if(grade = ‘A’, 1, 0))numberA
- FROM enrollment
- GROUP BY cid, section) t2,
- (SELECT cid, section, count(*) as allStuds
- FROM enrollment
- GROUP BY cid, section) t3
- WHERE t2.cid = t3.cid AND t2.section = t3.section;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement