Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do inside quotes
Message
De
11/09/2013 12:34:14
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 6.5 and older
Application:
Web
Divers
Thread ID:
01582787
Message ID:
01582870
Vues:
45
>
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform