Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

pivot table sql server

SELECT SalesAgent AS PivotSalesAgent, India, US, UK FROM tblAgentsSales
PIVOT 
(
	SUM(SalesAmount) FOR SalesCountry IN (India, US, UK)
)
AS testPivotTable


SELECT SalesAgent GrpBySalesAgent, SalesCountry, SUM(SalesAmount) Sales from tblAgentsSales 
GROUP BY SalesAgent, SalesCountry


select SalesAgent TableSalesAgent, SalesCountry, SalesAmount from tblAgentsSales
Source by www.oracle.com #
 
PREVIOUS NEXT
Tagged: #pivot #table #sql #server
ADD COMMENT
Topic
Name
1+1 =