The script is in accordance with what is intended, but the results from the JLH_jemaat column are more than what is intended if in the tbl_pmk table there are 2 same jemaah_ids but different quarters and years. this is the tabel tbl_pmkenter image description here