title: Replace the command SQL sum (case) numbers with letters
body: <p>Halo mister
  I have a program like this.
  I want to replace the numbers (in red boxes) with letters, along with the program display:</p>
  <p><a href="https://i.stack.imgur.com/LvCqO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LvCqO.jpg" alt="enter image description here" /></a></p>
  <p>The problem:</p>
  <ol>
  <li>When I replace numbers with letters, a program error occurs</li>
  <li>When I delete the SUM function, what happens next command is not recognized</li>
  </ol>
  <p>I want to replace the program output with letters</p>
  <p><a href="https://i.stack.imgur.com/Hx40A.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hx40A.jpg" alt="enter image description here" /></a></p>
  <p>Here is a program that I brief</p>
  <pre><code>$detail = DB::select('select s.nik, s.nama,
      SUM(CASE
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and j.masuk_senin &gt; b.berangkat and j.keluar_senin &lt; b.pulang and j.wf1 = &quot;WFO&quot; THEN &quot;10&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and  j.masuk_senin &lt; b.berangkat and j.keluar_senin &lt; b.pulang and j.wf1 = &quot;WFO&quot; THEN &quot;9&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and j.masuk_selasa &gt; b.berangkat and j.keluar_selasa &lt; b.pulang and j.wf2 = &quot;WFO&quot; THEN &quot;10&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and  j.masuk_selasa &lt; b.berangkat and j.keluar_selasa &lt; b.pulang and j.wf2 = &quot;WFO&quot; THEN &quot;9&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;01&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and 
      ELSE 0 END ) as h1,
  
      SUM(CASE
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and j.masuk_senin &gt; b.berangkat and j.keluar_senin &lt; b.pulang and j.wf1 = &quot;WFO&quot; THEN &quot;10&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and  j.masuk_senin &lt; b.berangkat and j.keluar_senin &lt; b.pulang and j.wf1 = &quot;WFO&quot; THEN &quot;9&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Monday&quot; and
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and j.masuk_selasa &gt; b.berangkat and j.keluar_selasa &lt; b.pulang and j.wf2 = &quot;WFO&quot; THEN &quot;10&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and  j.masuk_selasa &lt; b.berangkat and j.keluar_selasa &lt; b.pulang and j.wf2 = &quot;WFO&quot; THEN &quot;9&quot;
      WHEN date_format(b.tanggal, &quot;%d&quot;) = &quot;02&quot; and DAYNAME(b.tanggal)=&quot;Tuesday&quot; and 
      ELSE 0 END ) as h2
  
      from users s
      join tb_presensi b on s.id = b.id_user
      join tb_jammasuk j on s.id = j.id_user
      where b.tanggal between &quot;'.$dari.'&quot; and &quot;'.$sampai.'&quot;
      group by s.id, b.id_user
      order by s.nik ASC');
  </code></pre>