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
结果基础的表(编辑)MySQL的2个表查询问题
A_ID:1 a_value:text1的总数:3条记录
A_ID:2 a_value:text2的总数:2条记录
如何在sql中获取这种格式?
查询表,添加一个字段(总)计数b.a_id = a.a_id表B
谢谢你..
根据你在表格b中的数据,你如何得到以下结果:a_id:2 total:2 records'? – InSane 2010-10-23 07:27:12
你是如何得到3条和2条记录的?你确定b表数据是正确的吗? – 2010-10-23 07:27:36
你想获得'b_id'的数量吗? – JoshD 2010-10-23 07:27:38