Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Trouble with Query

Author  Topic 

kravi88
Starting Member

3 Posts

Posted - 2014-06-07 : 19:16:01
Hi All,

I'm trying to use Excel as a data source and am making the query using MS Query.
The following query worked using SQL Server Management Studio but is not working for Excel:
-------------------------------------------------------
select e1.name
,e1.role
,r1.duty
,d1.conflict
from emp as e1, [role] as r1, conflict as d1
where
e1.[role]=r1.[role] and
r1.duty=d1.duty
and exists (select 1
from emp as e2, [role] as r2, conflict as d2
where
d2.duty=r2.duty and
r2.[role]=e2.[role] and
e2.name=e1.name
and r2.role<>r1.role
and r2.duty<>r1.duty
and r2.duty=d1.conflict
)
order by e1.name

--------------------------------------------------------

Please advice.

Thanks and regards !
   

- Advertisement -