Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> SQL question: ...where x in (1,2,3)
Hi!
I got a (hopefully) simple SQL question:
select distinct * from Tb_dept
where DeptID = 64
and CompanyID = 12345
and Status='AC'
and StoreLocID in (xx,yy,zz)
The values xx,yy, zz come from a sub-select statement like this:
select storelocID from
( select count(*) as numstores from tbdept
where companyID = 12345
and storelocID in (1,2)
and status = 'AC'
and Deptid = 64
group by storelocID
)
The question is: the number of rows returned from the sub-select may be different (i.e. just xx or xx and yy and zz).
How can I modify the first statement that I only get rows back that are in all StoreLocID's ???
Sounds confusing? Received on Tue Oct 10 2000 - 18:00:10 CDT