title: i am confused make this query to codeigniter - sum, distinct, join multiple conditions
body: <p>I have a correct mysql query but I am really confused to convert this to CI.
  The result i want is just like this
  <a href="https://i.stack.imgur.com/58lpJ.png" rel="nofollow noreferrer">query result</a></p>
  
  <pre><code>select sum(distinct(tns.nilai)),tns.nis
  from trs_nilai_sikap tns inner join trs_riwayat_nilai_sikap trns
  on trns.id_tahun_ajar = 2
  and tns.nis = 1800217
  and trns.tipe_nilai = 1
  and trns.id_riwayat_nilai_sikap = tns.id_riwayat_nilai_sikap
  </code></pre>