I am getting an error:
Msg 102, Level 15, State 1, Line3
Incorrect syntax near '('.
It doesn't like something below:
select * from cte PIVOT (max(Phone) FOR Row IN ([Phone1],[Phone2],[Phone3])) pvt
I am using SQL server 2008.
Thanks in advance
Adam
I have 2 tables - student table, contact table
Student table:
student_id (key)
fname
lname
Contact table:
student_id (key)
contact_id (key)
fname
lname
phone
Multiple contact records for each student id - max I have found is 10 records
student_id, phone
11111, 5551212
11111, 5553434
11111...
This is what I am trying to do. I can get the xtab in a report and do a sum on 2004 and 2005 but I cannot figure out how to do the difference. I need to take the total for month 1 year 2005 and subtract month 1 year 2004, then month 2, etc. If the sales for the product was 50 for January 2005...
I have a cross tab query that I am putting on a report. The months 1,2,3..12 print on the top. I need to calculate the difference in month 1 between 2005 & 2004, then month 2, etc. Here is my crosstab query below:
TRANSFORM Sum([sales query 2004-2005].Quantity) AS SumOfQuantity
SELECT [sales...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.