title: rails using sql variables in find_by_sql
body: <p>I have this query:</p>
  
  <pre><code>SET @current_group = NULL; 
  SET @current_count = 0; 
  SELECT user_id, MIN( created_at ) as created_at, CASE WHEN @current_group = user_id THEN @current_count WHEN @current_group := user_id THEN @current_count := @current_count + 1 END AS c 
  FROM notifies 
  G    ROUP BY user_id, c 
  ORDER BY id desc LIMIT 0 , 10
  </code></pre>
  
  <p>If i launch it it works</p>
  
  <p>but if i put it in a find_by_sql method like:</p>
  
  <pre><code>Notify.find_by_sql("SET @current_group = NULL; SET @current_count = 0; SELECT user_id, MIN( created_at ) as created_at, CASE WHEN @current_group = user_id THEN @current_count WHEN @current_group := user_id THEN @current_count := @current_count + 1 END AS c FROM notifies GROUP BY user_id, c ORDER BY id desc LIMIT 0 , 10")
  </code></pre>
  
  <p>It returns this error:</p>
  
  <pre><code>Mysql2::Error: 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 'SET @current_count = 0; SELECT user_id, MIN( created_at ) as created_at, CASE WH' at line 1:
  </code></pre>
  
  <p>How can i do?</p>
  
  <p>thanks</p>