I'm using SQL Server and I need to display the information on the query by columns. Currently, the information is displayed as:
ProjectID FiscYr Period Amt
4231 2015 1 100
4231 2015 1 820
*** *** *** ***
*** *** *** ***
4231 2015 12 733
needs to be formatted as:
ProjectID FiscYr Period 01 Period 02 *** *** Period 12
4231 2015 100 820 *** *** 733
Existing query is:
SELECT substring([project],11,4) as ProjectID
,substring([fiscalno],1,4) as FiscYr
,substring([fiscalno],5,2) as Period
,sum([amount]) as Amt
FROM [dbo].[PJTran]
WHERE (((pjtran.gl_Acct) Like '12%' or (pjtran.gl_Acct) Like '13%'))
group by substring([project],11,4),substring(fiscalno,1,4),substring([fiscalno],5,2);