title: Why does passing one date query via Mysql2 from Ruby work but another not?
body: <p>EDITED for clarity and added info:</p>
  
  <p>Total newbie to Ruby coding (and coding in general) so please be gentle.</p>
  
  <p>I have a MySQL database, and I want to pull out some data from one of the tables, a column of which is labelled "fulldate".</p>
  
  <p>The following code works to pull out all rows after a certain date.</p>
  
  <pre><code>start_date = Date.new(2018, 1, 2)
  end_date  = Date.new(2018, 1, 12)
  
  clw_check = client.query('SELECT * FROM rotadates WHERE fulldate &gt;"#{start_date}"')
  clw_check.each do |row| puts row["fulldate"] end
  </code></pre>
  
  <p>Then the output is a list of dates from each row.</p>
  
  <p>However, when I change to </p>
  
  <pre><code>clw_check = client.query('SELECT * FROM rotadates WHERE fulldate &lt;"#{end_date}"')
  clw_check.each do |row| puts row["fulldate"] end
  </code></pre>
  
  <p>then this produces</p>
  
  <pre><code>=&gt; []
  </code></pre>
  
  <p>If I put the date instead of the #{} expression, then I get a list of dates with both less than and greater than expressions.</p>
  
  <p>I have searched StackOverflow and the net in general, but cannot for the life of me work out why it works with the first expression the second.</p>
  
  <p>A check on whether start_date and end_date are dates or strings says they are dates, and the MySQL column is also a date with identical yyyy-mm-dd format.</p>
  
  <p>Example of rows from MySQL table:</p>
  
  <h2>rotadates</h2>
  
  <p>| idDate | fulldate | year | month | day | quarter | week | dayOfWeek | weekend | clw |<br>
  | 20180102 | 2018-01-02 | 2018 | 1 | 2 | 1 | 1 | 2 | 0 | 1 |<br>
  | 20180103 | 2018-01-03 | 2018 | 1 | 3 | 1 | 1 | 3 | 0 | 1 |<br>
  | 20180104 | 2018-01-04 | 2018 | 1 | 4 | 1 | 1 | 4 | 0 | 1 |<br>
  | 20180105 | 2018-01-05 | 2018 | 1 | 5 | 1 | 1 | 5 | 0 | 1 |<br>
  | 20180106 | 2018-01-06 | 2018 | 1 | 6 | 1 | 1 | 6 | 1 | 1 |  </p>