I having trouble with this query
it is executing quit well but I cannot make out
how is this select statement working.
Any help or explaination on this problem will be appereciated ..
thank you

select * from emp
where eid 
IN (select eid from works 
     where cid=(select cid from company 
                where city=emp.city))
3 Years
Discussion Span
Last Post by rch1231

The query first selects the CID (or city id from what I see) using the employee city shown on the page or in the query.

Then is selects the eid (employee ID's) for all employees whos cid in the works table is equal to the CID pulled from the company data.

It then selects all fields from the employee table whos city is equal to the CID.

Hope that helps

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.