Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do inside quotes
Message
From
11/09/2013 12:34:14
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 6.5 and older
Application:
Web
Miscellaneous
Thread ID:
01582787
Message ID:
01582870
Views:
46
>
>Did you try running
>
>
>;with cte as ( 
>SELECT sponsor, fundtype, amount
>FROM TIP_ApprovedFunding f
>INNER JOIN TIP_Projects p ON p.TipID = f.TipID
>WHERE p.ApprovedStatus = 'Active'
>) 
> SELECT * from cte  
> PIVOT
> (
> SUM(amount) FOR FundType IN ([HSIP], [PL], [SPR], [STP], [TAP])
> ) 
> AS PivotTableAlias
>
>
>This should work.
>
>Also, it should be
>execute (@SQL)
>
>Note the parenthesis.

Would you also know how to sort the result by Sponsor? Seems like it doesn't like ORDER BY no matter where I put it.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform