I currently have the following query and it works because I have a column in t2 that contains the same ikey as t1:
$sql = "
SELECT
us_mkr.*,
t1.ikey,
t1.tag,
t2.events
FROM t1
LEFT JOIN us_mkr ON (us_mkr.mkr_key = t1.ikey)
LEFT JOIN t1 ON (t1.ikey = t2.ikey)
WHERE t1.slug = '" . $_GET['title'] . "'
AND us_mkr.county LIKE '%" . addslashes($county) . "%'";
However, I would like to change that column in t2 to store a string instead of a single key value. So I was thinking that all I could do is to change my JOIn to INSTR, like this:
$sql = "
SELECT
us_mkr.*,
t1.ikey,
t1.tag,
t2.events
FROM t1
LEFT JOIN us_mkr ON (us_mkr.mkr_key = t1.ikey)
LEFT JOIN t1 ON INSTR(t2.ikeys, t1.ikey) > 0
WHERE t1.slug = '" . $_GET['title'] . "'
AND us_mkr.county LIKE '%" . addslashes($county) . "%'";
But it doesn't seem to work so I wonder what am I missing.