wantabe2
asked on
SQL Query Help Needed
I have the following query that pulls the data from a mysql database.
The above code works great. I'm trying to add to it but can't figure out how to make it pull all task except any that is listed as work.
How would I edit the query to display all the task except any listed as WORK?
$query="SELECT sid, name, status, task FROM supervision WHERE name = 'employee1' AND active='1'";
The above code works great. I'm trying to add to it but can't figure out how to make it pull all task except any that is listed as work.
How would I edit the query to display all the task except any listed as WORK?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How to know if a task is listed as work or not?
You neglect to say if WORK is a value of one of your selected fields or another field...
Assuming WORK is a value of "status" you would add:
AND status <> 'WORK' to your select...
If it is associated with another field, adjust the AND clause as appropriate...
Assuming WORK is a value of "status" you would add:
AND status <> 'WORK' to your select...
If it is associated with another field, adjust the AND clause as appropriate...
@wantabe2
My mind reading license expired, or was it my because crystal ball rolled off the desk....
It really isn't fair to make us volunteers guess how a table only you have access to defines if a task is 'work' or not 'work', the relevant facts should be included in the question - and we will fall over ourselves to provide the correct sql syntax
We really only know a table exists called `supervision` with these fields:
`sid`, `name`, `status`, `task` , `active`
`name` and `active` both appear to hold strings (not sure why `active` would do that)
My mind reading license expired, or was it my because crystal ball rolled off the desk....
It really isn't fair to make us volunteers guess how a table only you have access to defines if a task is 'work' or not 'work', the relevant facts should be included in the question - and we will fall over ourselves to provide the correct sql syntax
We really only know a table exists called `supervision` with these fields:
`sid`, `name`, `status`, `task` , `active`
`name` and `active` both appear to hold strings (not sure why `active` would do that)
@rjohnsonjr, you must have renewed that mind reading license :)