I have a table setup with the following rows:
orderfrom | Name
-------------------------------------------------------
ClearVision, Oakley, I-Deal Optics | ClearVision
ClearVision | I-Deal Optics
ClearVision | Oakley
I want a query that will select rows where the “Name” value is not found in the “orderfrom” column. In this case, it would return the 2nd and 3rd rows, but not the first row (since “ClearVision” is in the orderfrom column).
Here is what I’ve tried:
SELECT * FROM `dist`
JOIN `patientacct`
ON `patientacct`.dist LIKE CONCAT('%', `dist`.name ,'%')
INNER JOIN `treasure`
ON `treasure`.`id` = `patientacct`.`id`
WHERE (status = 'To Order' AND ****** ORDER BY `name` ASC);
The ** part is where I need help. I have tried this:
(( `dist`.name NOT LIKE CONCAT('%',`patientacct`.orderfrom,'%')) ))
INNER JOIN
treasureON
treasure.id=patientacct.idWHERE
status = ‘To Order’
AND
dist.name NOT LIKE CONCAT(‘%’,patientacct.orderfrom,’%’)