i need to do this :
There is a table called table1 it has a employee id column,status column which has values 1 and 0 only and a department column with values 100,101,102.
i want to list all employeeid with the status = 0 and (department=100 whose status=1)
Please help me
Where Status = 0 or (Department = 100 And Status = 1)
You can write your condition in SQL almost like you wrote it in english (except you'll use a or
instead of a and
) :
select *
from table1
where status = 0
or (status = 1 and department = 100)
This will return all employees :
- that have a 0 status
- or have a 1 status and have departement 100