PDA

View Full Version : search condition (exclude)


joonstar
05-11-2003, 10:11 AM
I like to call all teachers except math teachers.

I mean that every registered members who entered his job as teachers, but exclude(minus) math teachers.


It would be something like below

WHERE job like '% teacher%' and job like '% ! math%'

The above code doen't work but will help you understand my intention.

help please!

Spookster
05-11-2003, 04:20 PM
WHERE job like '%teacher%' and job != 'math'

joonstar
05-11-2003, 05:19 PM
Thank you for your concerning.

I apply your code in my php file, But It also shows all teachers including math teachers.

Next was my actual applying your code.


if($sname=='10')
$strWhere .= " and (a.family_job like '%teacher%' and a.family_job != 'math' ) ";

Do you see any problem in my applying?

raf
05-11-2003, 06:37 PM
The if line doesn't seam right (the end should be then or {
Try replacing != by Not + the value for mathteachers will probably not be 'math' but something like 'math teacher' or so.