Test thread with code - Remix Video
Skip to main content
Post Reply
March 8, 2016 0:47 AM #1

Posts: 1
Points: 10
Joined: March, 2016

Test thread with code

SELECT UPPER(tc.FName + ' ' + tc.LName) AS Coun, ISNULL(df.Ferry,0) AS Ferr, ISNULL(df.Accommodation,0) AS Acco, ISNULL(df.Flights,0) AS Flig, ISNULL(df.Internet,0) AS Inte, ISNULL(df.Mileage,0) AS Mile, ISNULL(df.Other,0) AS Othe, ISNULL(df.Telephone,0) AS Tele, ISNULL(df.Meals,0) AS Meal, ISNULL(df.Train,0) AS Trai, ISNULL(df.Taxi,0) AS Taxi, ISNULL(df.Laundry,0) AS Laun, ISNULL(df.Ferry,0)+ISNULL(df.Accommodation,0)+ISNULL(df.Flights,0)+ISNULL(df.Internet,0)+ISNULL(df.Mileage,0)+ISNULL(df.Other,0)+ISNULL(df.Telephone,0)+ISNULL(df.Meals,0)+ISNULL(df.Train,0)+ISNULL(df.Taxi,0)+ISNULL(df.Laundry,0) AS TOTALS FROM ( SELECT IDNo, Expense, ExpenseType FROM TblExpense WHERE ExpenseYear = 2016 ) ps PIVOT ( SUM (Expense) FOR ExpenseType IN ( [Accommodation], [Flights], [Internet], [Mileage], [Monthly Allowance], [Other], [Telephone], [Meals], [Train], [Taxi], [Laundry], [Ferry] ) ) df INNER JOIN dbo.TblCouncillor tc ON tc.IDNo = df.IDNo

Post Reply