title: mysql 8 pivot query should return a non null value
body: <p>I would like the following pivot query to show value 0 instead of null,</p>
  <pre><code>SELECT 
      pi.employeeId,
      pi.Id,
      MAX(CASE
          WHEN pi.category = 'Repayment' THEN pi.value
          WHEN isnull(pi.category) = 1 then 0
          -- ELSE 0
      END) as 'Repayment',
       MAX(CASE
          WHEN pi.category = 'Salary' THEN pi.value
          ELSE 0
      END) as 'Salary',
       MAX(CASE
          WHEN pi.category = 'Allowance' THEN pi.value
          ELSE 0
      END) as 'Allowance'
  FROM
     payData pi
  GROUP BY pi.employeeId , pi.Id ;
  </code></pre>
  <p>Output for the above is,</p>
  <pre><code>employeeId     Id      Repayment    Salary  Allowance
    121          2           2000     15000     1000
    122          2           null     20000     2000
  </code></pre>
  <p>Employee id 122 does not have a <em>Repayment</em> value so the desired output is,</p>
  <pre><code>employeeId     Id      Repayment    Salary  Allowance
      121        2         2000       15000     1000
      122        2           0        20000     2000
  </code></pre>
  <p><a href="https://dbfiddle.uk/?rdbms=mysql_8.0&amp;fiddle=760720a8c4acf3e7a3d8f6a7ab9cc965" rel="nofollow noreferrer">dbfiddle</a></p>