My database is listing Jobs. I want a user to be able to query jobs from a particular industry but chose as many work-types from the type column as they want, eg:
SELECT * FROM `rec_jobs`
WHERE `industry` LIKE '%Security%' AND
(`type` LIKE '%Full-Time%' OR 'type' LIKE '%Part-Time%' OR 'type' LIKE '%Casual%' OR 'type' LIKE '%Contract%');
This should return something like:
ID - Industy - Type
1 - Security - Part-Time
2 - Security - Full-Time
3 - Security - Casual
4 - Security - Full-Time
etc.
but it is not working as expected - I dont get any SQL errors or any results (though I know rows exist).
Does anyone know a better way of achieving this (or the correct terminology to search in Google)?
you should use the same quotes around the column name type:
SELECT *
FROM `rec_jobs`
WHERE `industry` LIKE '%Security%'
AND (
`type` LIKE '%Full-Time%'
OR `type` LIKE '%Part-Time%'
OR `type` LIKE '%Casual%'
OR `type` LIKE '%Contract%');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With