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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Error on my SQL Query - Help Please

Author  Topic 

satyen
Starting Member

21 Posts

Posted - 2012-08-07 : 09:49:21
I am getting an error message saying:


The column 'casecode' was specified multiple times for 'myCTE'.


Any ideas how to solve this?

Query:

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

set dateformat dmy

WITH myCTE AS
(

select
a.casecode as casecode,
a.name,
a.appdate as Appointment_Date,
a.start as Petition_Date,
a.award as Order_Date,
a.taxref,
a.accyearend,
a.closed,
a.type,
a.loc,
a.nominee_1 as Lead_IP,
a.nominee_2 as Second_IP,
c.plainnote,
c.addedby,
c.adddatetime,
d.casecode,
d.desc1,
d.ddate

from ips_case_nominee a left outer join ips_casestaff b on a.casecode = b.casecode
left outer join ips_notes c on a.casecode = c.casecode left outer join ips_diary d on d.casecode = a.casecode
and c.casecode = b.casecode
and c.systemgenerated is null

and c.entryno =
(select top 1 c.entryno
from ips_notes c
where c.casecode = a.casecode and
c.ntype = 'TAX NOTE'
order by c.entryno desc)


where LoginName like 'Tax - Manager%'
and d.desc1 like '%Tax Due%'
)
select top (1)*
from myCTE
order by ddate

satyen
Starting Member

21 Posts

Posted - 2012-08-07 : 09:57:50
sorry guys solved it
Go to Top of Page
   

- Advertisement -