title: how to use mysql case or sub query in single query
body: <p>I have tried like this code:</p>
  
  <pre><code>SELECT
    ca.batch_code, s.stu_surname, s.cdc_no, s.passport_no,
    p.special_approval, p.special_approval_amount  
  FROM  course_apply ca 
    INNER JOIN student s ON ca.stu_code = s.stu_code
    INNER JOIN payment_detail p ON p.stu_code = ca.stu_code
  ORDER BY ca.batch_code ASC
  </code></pre>
  
  <p>I need output like that:</p>
  
  <p>Special approval available means display special approval amount otherwise that field value 0</p>