Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL INNER JOIN - '=' vs 'like'
    primarykey
    data
    text
    <p>We're having some odd issues with MySQL inner joins. Basically, we get an odd error when using an '=' operator but using 'like' instead makes it work. Unfortunately, this is via ActiveRecord and no easy way to just slap 'like' in there instead, plus we want to understand what's actually happening here.</p> <p>Here is the query that fails:</p> <pre><code>mysql&gt; SELECT COUNT(*) FROM `versions` INNER JOIN `site_versions` ON `versions`.id = `site_versions`.version_id; </code></pre> <p>Here is the error:</p> <pre><code>ERROR 1296 (HY000): Got error 20008 'Query aborted due to out of query memory' from NDBCLUSTER </code></pre> <p>Here is the query that works:</p> <pre><code>mysql&gt; SELECT COUNT(*) FROM `versions` INNER JOIN `site_versions` ON `versions`.id like `site_versions`.version_id; </code></pre> <p>Here are some details on the tables themselves:</p> <pre><code>mysql&gt; desc site_versions; +----------------------+----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------------+----------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | version_id | int(11) | YES | MUL | NULL | | [..snip..] +----------------------+----------+------+-----+---------+----------------+ mysql&gt; desc versions; +------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | [..snip..] +------------+--------------+------+-----+---------+----------------+ </code></pre> <p>Any ideas why the 'like' works and the '=' does not?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload