sql - Why does the HAVING clause need to come after the GROUP-BY? -


i want understand logically why need having clause after group-by ?

select name actor id in (     select actorid    casting    ord = 1  group actorid having count(*) > 29  ) order name asc 

it hasn't clicked yet me, why following incorrect :

having count(*) > 29 group actorid 

the reason because sql group records before evaluates having clause.

it sql syntax, makes intuitive sense, jeroen points out :

having applies result of grouping, in particular, unusual case, sql following chronological order of query steps.

10 tips sorting sql - techrepublic


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -