Thursday, November 13, 2014

Lesson 38: the order of SELECT, FROM, WHERE, etc... in mySQL

I dont think i've posted this before, but for those who's confused for the order of SELECT, GROUP BY, ORDER BY here's the order of the syntax:

SELECT
    ...
    [FROM table_references
    [WHERE where_condition]
    [GROUP BY {col_name | expr | position}
      [ASC | DESC], ... [WITH ROLLUP]]
    [HAVING where_condition]
    [ORDER BY {col_name | expr | position}
      [ASC | DESC], ...]
    ...
   
for more info visit:
http://dev.mysql.com/doc/refman/5.0/en/select.html

No comments:

Post a Comment