0

"group by is used to organize the data before other clauses - such as where, order by and functions -are applied. In contrast, order by is applied last- after the query has been resolved -to reorganize the query output for display.",really? Ref: Learning MySQL

I have surfed the net regarding this but couldn't find anything like this. Is this an error in book?


update: I just notices alias works in group by which means it is getting executed after select, since select is executed after where , can we safely say that it was an error with the book and group by is executed after where clause?

ekad
  • 14,436
  • 26
  • 44
  • 46
Sandy
  • 313
  • 1
  • 4
  • 13

1 Answers1

0

Better explanation is here http://www.bennadel.com/blog/70-SQL-Query-Order-of-Operations.htm

Madhivanan
  • 13,470
  • 1
  • 24
  • 29
  • thanks Madhivanan for the link but i am confused with this order because group by supports alias so it is definitely executed after select ( 1. FROM clause 2. WHERE clause 3. GROUP BY clause 4. HAVING clause 5. SELECT clause 6. ORDER BY clause ) – Sandy Jul 17 '12 at 05:06