I’m trying to do a Select Statement in Oracle using the Operator LIKE % and for some reason the lines of output are taking on zipcodes of different people. Here is my code:
Select Distinct a.empno,a.ename,a.sal,a.job,b.empadr,b.empstate,b.empzip
From EMP a, EMPADDRESS b
Where a.empno = b.empno
And b.empzip Like '1%'
Or b.empzip Like '8%'
I tried adding brackets around the AND and OR but that didn’t seem to work. I’m assuming it has something to do with how I wrote the columns in the first line but I’m not sure. If that is the case can someone explain why that happens, I would hate to have this problem again. Thanks in advance to all that answer.
The brackets are missing:
or you could use the JOIN syntax