title: Rewrite the query to get output for cross years?
body: <pre><code>SELECT
           sum(case
                   when "year"  = '2016' then "svalue"
                   ELSE 0
               END) as 'sva_2016',
           sum(case
                   when "year"  = '2017' then "svalue"
                   ELSE 0
               END) as 'sva_2017',
           sum(case
                   when "year"  = '2018' then "svalue"
                   ELSE 0
               END) as 'sva_2018',
           sum(case
                   when "year"  = '2019' then "svalue"
                   ELSE 0
               END) as 'sva_2019',
           sum(case
                   when "year"  = '2016' then "ltr"
                   ELSE 0
               END) as 'lva_2016',
           sum(case
                   when "year"  = '2017' then "ltr"
                   ELSE 0
               END) as 'lva_2017',
           sum(case
                   when "year"  = '2018' then "ltr"
                   ELSE 0
               END) as 'lva_2018',
           sum(case
                   when "year"  = '2019' then "ltr"
                   ELSE 0
               END) as 'lva_2019',
           'Apr 1 - Jan 31' as 'Period',
           "code" as 'FACode'
  FROM  "FCJOIN" 
  WHERE    "code"  IN
      (
      SELECT "fccode"
      FROM  "fcdetails" 
      )
   AND    "month"  between '04'  and  '12'
   AND    "year"  IN ( '2016'  , '2017'  , '2018'  , '2019'  )
  GROUP BY  "code" 
  </code></pre>
  
  <p>The above query gives me the correct out put for svalues and ltr for </p>
  
  <ul>
  <li>April 2016- December 2016</li>
  <li>April 2017- December 2017</li>
  <li>April 2018- December 2018</li>
  <li>April 2019- December 2019</li>
  </ul>
  
  <p>Now I want to get the values of svalues and ltrs for the period of </p>
  
  <ul>
  <li>April 2016- January 2017</li>
  <li>April 2017- January 2018</li>
  <li>April 2018- January 2019</li>
  <li>April 2019- January 2020</li>
  </ul>