sql query????
Out of curiosity (I dont know much about sql queries) why would the query below flag an error and not work if 'FROM' was to followed directly on after the first instance of Max(departDate) ???? (difficult to see below but there is a break directly before FROM so it goes onto its own line.
$excursionMonth = $conn->query("SELECT DISTINCT departMonth, excursionYear, MAX(departDate)
FROM excursions GROUP BY departMonth, excursionYear ORDER BY MAX(departDate) ASC") or die($conn->error);
If FROM is not started on its own line the browser error is:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'excursions GROUP BY departMonth, excursionYear ORDER BY MAX(de' at line 1
OR error in sql console:
2 errors were found during analysis.
- An alias was previously found. (near "excursions" at position 80)
- Unexpected token. (near "excursions" at position 80)
If FROM is on its own line there are no errors and the query works.
So from that can I assume that some sql statements need to go on their own line?
