I have another question. The results I got from the query from earlier were correct but now I want to left outer join those results to another table. Here's my query:
(
select a.eid, a.tid, a.tc, a.ts
from et a
join (select eid, count(distinct tc) tcc
from et
where ts='?' and tid='STATE' and (ytw > 0 and ytow > 0)
group by eid
having count(distinct tc) > 1) b
on a.eid = b.eid
) y
left outer join (select eid, eno, fn, ln, mn from ep) x
on y.eid=x.eid
When I run this query, it tells me incorrect syntax near 'y' and incorrect syntax near 'x'. I'm new to SQL and I'm not sure why its giving me this error. Please help.
(
select a.eid, a.tid, a.tc, a.ts
from et a
join (select eid, count(distinct tc) tcc
from et
where ts='?' and tid='STATE' and (ytw > 0 and ytow > 0)
group by eid
having count(distinct tc) > 1) b
on a.eid = b.eid
) y
left outer join (select eid, eno, fn, ln, mn from ep) x
on y.eid=x.eid
When I run this query, it tells me incorrect syntax near 'y' and incorrect syntax near 'x'. I'm new to SQL and I'm not sure why its giving me this error. Please help.