Adem Natural Adem Natural - 1 year ago 61
PHP Question

how to get num row where object by other table use codeigniter

I have 2 tables. Consider tb_burung and tb_data.
This is the structure of tb_burung:

enter image description here

This is the structure of tb_data: table structure

I want to get the number of rows of tb_data order id_burung for viewing on a page like this:
output page


Not sure what exactly you want to achieve, but just try following sql:)

select t1.burung, count(t2.id_burung) as burungCnt
from tb_burung t1
left join tb_data t2 on t1.id_burung = t2.id_burung
group by t1.id_burung, t1.burung