Reputation: 21
Select q1.*, q2.JobNumber
from (
select p.ProgramName, p.FulfillmentType, p.JobNumber, count(*) as [Counts]
from tProduction_AHFS p inner join tScanner s on p.ItemCode1 = s.ItemCode1
where (
s.ScanStatusCode = 0
)
group by p.ProgramName, p.FulfillmentType, p.JobNumber
)
q1 inner join (
select p.ProgramName, p.FulfillmentType, p.JobNumber, count(*) as [Counts]
from tProduction_AHFS p inner join tScanner s on p.ItemCode1 = s.ItemCode1
where (
s.ScanStatusCode <> 0
)
group by p.ProgramName, p.FulfillmentType, p.JobNumber
) q2 on q1.JobNumber = q2.JobNumber
An item with the same key has already been added - getting this error for SSRS 2008. SQL runs fine. but this error... where do i make changes?
Upvotes: 0
Views: 227
Reputation: 349
I'm assuming from the last line of your SQL code that table q1 has a "JobNumber" column? Since you are returning q1.*, you will be including q1.JobNumber along with q2.JobNumber -- SSRS doesn't like it when you return 2 columns with the same name. Add an Alias for q2.JobNumber (i.e. q2.JobNumber AS Q2JobNumber), and that will probably fix it.
Upvotes: 1