sql - Unable to comprehend why a WHERE clause is being accepted -


this question has answer here:

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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -