I was called many times by Jr. Programmers in team to debug their SQL. I keep log of most of the problems and review them afterwards. This helps me to evaluate my team and identify most important next thing which I can do to improve the performance and productivity of it. Recently we have many new hires and they had almost similar questions. Since, I have send them following sequence of the SELECT clause I am not interrupted often, which helps me to focus on larger project architectural design.
GROUP BY yourcolumns
HAVING aggregatecolumn condition
ORDER BY yourcolumns
Once above order is memorized it guides the basic construction of SELECT statement. This article is written keeping in mind beginners in SQL Server language and presents very higher level outline of SELECT statement.
Reference : Pinal Dave (https://blog.sqlauthority.com)