title: Mysql Truncated incorrect DOUBLE value in INSERT query
body: <p>I know there are lots of bugs like this around here but this query seems to be different, as it's an insert query. Here is the schema for the table card_info:</p>
  <pre><code>CREATE TABLE card_info (
   card_id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
   card_name_orig varchar(150) NOT NULL,
   card_name_html varchar(150) NOT NULL,
   card_name_search varchar(150) NOT NULL,
   card_name_page varchar(150) NOT NULL,
   card_cost varchar(50) DEFAULT NULL,
   card_cost_converted tinyint(2) NOT NULL DEFAULT '0',
   card_subtype varchar(75) DEFAULT NULL,
   card_oracle_text_orig text,
   card_oracle_text_html text,
   card_power varchar(10) DEFAULT NULL,
   card_toughness varchar(10) DEFAULT NULL,
   card_loyalty tinyint(1) DEFAULT NULL,
   PRIMARY KEY (card_id),
   KEY card_name_nd (card_name_search),
   KEY card_name_page (card_name_page),
   KEY card_cost_converted (card_cost_converted),
   KEY card_power (card_power),
   KEY card_toughness (card_toughness),
   KEY card_loyalty (card_loyalty),
   FULLTEXT KEY card_oracle_text_orig (card_oracle_text_orig),
   FULLTEXT KEY card_name_search (card_name_search)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  </code></pre>
  <p>And here is my query:</p>
  <pre><code>INSERT INTO card_info (
   card_name_orig, card_name_html, card_name_search, card_name_page, card_cost,
   card_cost_converted, card_subtype, card_oracle_text_orig, card_oracle_text_html,
   card_power, card_toughness, card_loyalty
  )
  SELECT DISTINCT
   d.name_orig, d.name_html, d.name_search, d.name_page, d.cost,
   COALESCE(d.cost_converted, 0),   d.type_sub, d.oracle_text_orig,
   d.oracle_text_html, d.`power`, d.toughness, d.loyalty
  FROM card_info_de d
  LEFT OUTER JOIN card_info i ON d.name_search = i.card_name_search
  WHERE i.card_id IS NULL
  AND d.edition_id = 'isd'
  ORDER BY (d.collector_number + 0), d.collector_number;
  </code></pre>
  <p>If I perform this query, I'm getting this error:</p>
  <h1>1292 - Truncated incorrect DOUBLE value: '181a'</h1>
  <p>Please note that the value <strong>181a</strong> is from the column <strong><code>card_info_de</code>.<code>collector_number</code></strong> and it is a <strong>VARCHAR(5)</strong> field, and that field isn't being inserted to the <strong><code>card_info</code></strong> table anyway, it's just being used in the order clause of the select query.</p>
  <p>If I do the query starting from the <code>SELECT</code> only, I can see the correct results are being selected, but when I do the insert, it gives me the error above. Do note that If I remove the ORDER BY clause from the SELECT query, it inserts fine. I don't have a clue what I'm doing wrong.</p>
  <p>Thanks in advance.</p>