title: Syntax Error with ASC, DESC with MySQL 8.0
body: <p>I recently migrated my clients legacy infrastructure which entailed moving there old MySQL 5.0 database into a MySQL 8.0 database (We had some other issues while migrating to Server 2016 that meant we had to do this) </p>
  
  <p>Anyway the client has contacted me today as one of there queries is not working and I can't get to the bottom of it. </p>
  
  <p>It appears as if the following line is used on most / nearly all queries are not working.</p>
  
  <p><code>GROUP BY L.GrowerID, L.DCropID, C.Variety, C.Crop, L.SizeID DESC, S.Size;</code></p>
  
  <p>Full Query:</p>
  
  <pre><code>SELECT Cu.Customer, L.DCropID,  C.Crop, C.Variety,  D.Clone, G.Grower,
    S.Size, SUM(L.EndTubers) AS "Tubers", FORMAT(SUM(L.EndWeight),2) AS "Weight"
  FROM PotatoLabels.Crop C, PotatoLabels.PLabel2012 L, PotatoLabels.Sizes S,
    PotatoLabels.DCrop D, PotatoLabels.Customers Cu, PotatoLabels.Growers G,
    PotatoLabels.mmGrades M
  WHERE  (D.DCropID &gt; 96534 AND Cu.CustomerID = 9 AND G.GrowerID = 1 )
    AND L.CustomerID = Cu.CustomerID
    AND D.DCropID = L.DCropID
    AND C.CropID = D.CropId
    AND L.SizeID = S.SizeID
    AND L.GrowerID = G.GrowerID
  GROUP BY L.GrowerID, L.DCropID, C.Variety, C.Crop, L.SizeID DESC, S.Size;
  </code></pre>
  
  <p>If I remove 
  <code>GROUP BY L.GrowerID, L.DCropID, C.Variety, C.Crop, L.SizeID DESC, S.Size;</code></p>
  
  <p>It comes back with completely blank results but it does run with no syntax errors.</p>
  
  <p>Also worth mentioning, if I remove the <code>ASC</code> and (or) <code>DESC</code> the query runs without ascending &amp; descending filtering applied - Which is slightly better not not sufficient for my client.</p>
  
  <p>Please see below syntax errors I receive when using some of the faulting queries.</p>
  
  <pre><code>[Err] 1064 - 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 'DESC, S.Size' at line 12
  
  </code></pre>
  
  <pre><code>[Err] 1064 - 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 'ASC, L.SizeID DESC WITH ROLLUP' at line 22
  </code></pre>
  
  <p>I am no MySQL expert this has merely landed on my desk... I'm sure you understand.</p>
  
  <p>Any help would be great.</p>