CONCAT in a join. It works well in PHPMyAdmin, but the equivalent Drupal query doesn't work.
$query->join('taxonomy_term_data', 'td', 'sbc.tname LIKE CONCAT( td.name, "%\" ) AND td.vid = sbc.vid');
This query causes the following error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column '%\' in 'on clause'
However, the following query works fine.
$query->join('taxonomy_term_data', 'td', 'sbc.tname LIKE CONCAT( td.name, \'%\' ) AND td.vid = sbc.vid');
The only difference between the two queries is the string quotes: In the first one I used double quotes to wrap %; in the second one I used single quotes.
PHPMyAdmin gives me the result whether the % is wrapped with single quotes, or double quotes. (Actually, it should.)
I think there is something I'm missing. I'm just curious to know what it is.