Are you interested in becoming an AWS Certified Solutions Architect?
Discover a new interactive way of training for the exam.
Become a Premium Member and unlock a new, free course in leading technologies each month.
SELECT
SUM(T.SalesBal7) As July_2008,
SUM(T.SalesBal8) As Aug_2008,
SUM(T.SalesBal9) As Sept_2008,
SUM(T.SalesBal10) As Oct_2008,
SUM(T.SalesBal11) As Nov_2008,
SUM(T.SalesBal12) As Dec_2008
FROM arcpsale T
Left Outer Join arcusts T1 On T.CustID = T1.CustID
WHERE T1.CustAcct ='MAINE130^'
and T.FiscalYear =2008
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
SELECT
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal7 else 0 END) As July_2008,
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal8 else 0 END) As Aug_2008,
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal9 else 0 END) As Sept_2008,
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal10 else 0 END) As Oct_2008,
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal11 else 0 END) As Nov_2008,
SUM(CASE WHEN T.FiscalYear = 2008 then T.SalesBal12 else 0 END) As Dec_2008,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal1 else 0 END) As Jan_2009,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal2 else 0 END) As Feb_2009,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal3 else 0 END) As Mar_2009,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal4 else 0 END) As Apr_2009,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal5 else 0 END) As May_2009,
SUM(CASE WHEN T.FiscalYear = 2009 then T.SalesBal6 else 0 END) As Jun_2009
FROM arcpsale T
Left Outer Join arcusts T1 On T.CustID = T1.CustID
WHERE T1.CustAcct ='MAINE130^'
and T.FiscalYear BETWEEN 2008 AND 2009
SELECT
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal7 else 0 END) As July_2008,
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal8 else 0 END) As Aug_2008,
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal9 else 0 END) As Sept_2008,
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal10 else 0 END) As Oct_2008,
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal11 else 0 END) As Nov_2008,
SUM(CASE T.FiscalYear WHEN 2008 then T.SalesBal12 else 0 END) As Dec_2008,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal1 else 0 END) As Jan_2009,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal2 else 0 END) As Feb_2009,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal3 else 0 END) As Mar_2009,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal4 else 0 END) As Apr_2009,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal5 else 0 END) As May_2009,
SUM(CASE T.FiscalYear WHEN 2009 then T.SalesBal6 else 0 END) As Jun_2009
FROM arcpsale T
Left Outer Join arcusts T1 On T.CustID = T1.CustID
WHERE T1.CustAcct ='MAINE130^'
and T.FiscalYear BETWEEN 2008 AND 2009
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.