Hi All,
I am trying to get a summary query for all invoices and credit notes per branch.
Select [Branch], [Total Invoices] from
(Select case
when Series = '1' then 'DBN'
when Series = '2' then 'CPT'
when Series = '66' then 'JHB'
when Series = '67' then 'LKW'
Else 'PLZ' end [Branch],
DocTotal
from OINV ) A
Pivot
(sum(Doctotal) for [Branch] in ([Total Invoices])) as PVT
I get a syntax error
Msg 207, Level 16, State 1, Line 1
Invalid column name 'Branch'.
How do i correct this?
How do i incorperate the credit notes into this query?
Thanks,
Kiran