I have this mysql query
SELECT bm_events.name AS event_name,
bm_events.uid AS event_uid,
bm_events.organising,
bm_organising_company.uid,
bm_organising_company.name
FROM bm_events LEFT JOIN bm_organising_company
ON bm_events.organising = bm_organising_company.uid
And here is the result
Acontraluz 68 66,90 66 Advanced Music S.L.
Column "bm_events.organising" is a varchar with comma separated values.
So as "bm_events.organising" is equal to "66,90" on bm_events table, I expect to have no result for bm_organising_company.uid, bm_organising_company.name.
Could you explain to me why I got the result of bm_organising_company.uid = 66 ?
Thanks :)
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `bm_organising_company` ADD INDEX `bm_company_idx_uid` (`uid`);
SELECT
bm_events.name AS event_name,
bm_events.uid AS event_uid,
bm_events.organising,
bm_organising_company.uid,
bm_organising_company.name
FROM
bm_events
LEFT JOIN
bm_organising_company
ON bm_events.organising = bm_organising_company.uid