Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: a easy SQL question?
It should be AND. Emp_name should not start with BOTH r% and x%
logically speaking it is either
not (emp_name like 'R%' or emp_name like 'X%')
or it is
(emp_name not like 'R%' and emp_name not like 'X%')
Don't know how managed to get emp_name in dept, dept_name looks more logical.
Hth,
Sybrand Bakker, Oracle DBA
<yliu_at_creighton.edu> wrote in message
news:Pine.HPP.3.95.1000217144949.23009B-100000_at_penguin.creighton.edu...
> Hi All,
>
> I have a table called dept. Two of the fields in dept table is emp_name
> and deptno. I want to select every emp_name from dept table except for two
> deptno (R% and X%). I am confused on which operator to use: OR or AND.
> My SQL statement is like:
> select emp_name, deptno
> from dept
> where ...
> and (deptno not like X% or deptno not like R%)
> and ...;
>
> However, I don't know if I should use AND in the above where clause?
> Maybe somebody has some suggestions that will clear my confusion.
>
> Thanks in advance for helping.
>
> Yong
> yliu_at_creighton.edu
>
Received on Thu Feb 17 2000 - 00:00:00 CST
![]() |
![]() |