a table
a_id a_value
1 text1
2 test2
b table
b_id b_num a_id
1 5 1
2 7 1
3 2 1
4 7 2
5 56 2
Results base a table (edited)
a_id:1 a_value:text1 total:3 records
a_id:2 a_value:text2 total:2 records
How can get this format in sql?
query a table and add a field(total) count b.a_id = a.a_id in table b
thank you..