Re: about this SQL query (newbie here)
Date: Thu, 08 Feb 2001 18:45:25 GMT
Message-ID: <9PBg6.458$ub2.43237_at_newsread1.prod.itd.earthlink.net>
SELECT dept.location
,emp.last_name ,emp.first_name FROM department dept ,employee emp
WHERE dept.id = emp.dept_id
ORDER by dept.id
Or try a union if you really need to show a particular dept first.
SELECT dept.location
,emp.last_name ,emp.first_name FROM department dept ,employee emp WHERE dept.id = emp.dept_id AND dept.name = '&&&'
UNION ALL
SELECT dept.location
,emp.last_name ,emp.first_name FROM department dept ,employee emp WHERE dept.id = emp.dept_id AND dept.name != '&&&'
<" srcnckpc"_at_hotmail.com> wrote in message
news:3A828F3B.33D3E_at_hotmail.com...
> Get a list of employees in a department. Include the employee's name and
>
> location in your display. Show also the employees who are not in that
> department.
>
>
> I combined the EXISTS and NOT EXISTS operator in my query(after joining
>
> the emp and the dept tables), ie, get all the employees who EXISTS in
> that dept and get all the employees who NOT EXISTS in that department.
>
> I get the result "No rows selected." Does this mean the two results are
>
> canceling each other? Can you suggest an alternate method?
>
> Thanks
>
>
>
>
>
>
Received on Thu Feb 08 2001 - 19:45:25 CET