sql - Unable to comprehend why a WHERE clause is being accepted -
this question has answer here:
- sql - having vs where 7 answers
i trying understand difference between having , where. understand having
used group statements. however, cannot understand why following statement accepted:
select sum(child_id) children child_id = 5 group child_id
shouldn't correct statement select sum(child_id) children group child_id having child_id = 5
?
where clauses executed before grouping process has occurred, , have access fields in input table. having performed after grouping pocess occurs, , can filter results based on value of aggregate values computed in grouping process.
Comments
Post a Comment