I'm using a mixture of php and mysql to do the following query and I'm sure there must be a way to do it in just SQL. I've stripped out some of the code and left enough that you should be able to see what I'm trying to accomplish.
Any help would be much appreciated!
SELECT result_id FROM categories
WHERE name = "conventional"
foreach ( $results as $row ){
$query = "
DELETE FROM categories
WHERE result_id = $row->result_id && (name = 'va' OR name = 'fha' OR name = 'usda' OR name = 'other')
";
$this->db($query);
}
EDIT: From the answers I've received so far, I don't think I've explained this well enough. the columns in this table are id, result_id, name
There are multiple entries that share the same result_id as they relate to entries in the "results" table. So I'm trying to find the result_id's of entries with the name "conventional" so I can find all the entries with the same result_id and delete them if their names are "va", "fha", "usda" or "other"