Yes, you might get an error if you get the order of the clauses in a SQL query wrong. If your query comprises a WHERE clause and a GROUP BY clause, the WHERE clause must be run first.
If you execute the GROUP BY clause before the WHERE clause, the database engine must process all entries, including those that do not fit the constraints. This can unnecessarily slow down the query.