title: Mysql Syntax Error #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
body: <p>PLease look at my query there is a syntax error:</p>
  
  <pre><code>SELECT min(t.`status`) ,
   t.`moddate`,case @rownum when 1 then
    @rowdate := @rowdate
    @rownum+1
    else
   @rowdate := ((@rowdate + INTERVAL @timediff SECOND) - INTERVAL @timediff SECOND) 
   end
  FROM (SELECT `status`,`moddate` 
     FROM `globstats_graph`
     WHERE Cname='Cpmtree' AND IP='69.64.83.236'
     AND Port='3306' AND Variable='TABLE_LOCKS_IMMEDIATE'
     AND moddate between '2015-01-01 00:00' and '2015-02-01 00:00') t
  ,(
  SELECT @rowdate :='2015-01-01 00:00',SELECT @timediff :=ROUND((TIMESTAMPDIFF(SECOND,'2015-01-01 00:00','2015-02-01 00:00')/90)),@rownum:=1
  ) AS r, GROUP BY case @rownum when 1 then
    @rowdate := @rowdate
    @rownum+1
    else
   @rowdate := ((@rowdate + INTERVAL @timediff SECOND) - INTERVAL @timediff SECOND) 
   end
  </code></pre>
  
  <p>Could you please any one suggest me what went wrong.</p>