select a.action_id,b.action_name,a.phone
from (select action_id,count(*) phone from t_dest_phone group by action_id ) a, t_action b
where a.action_id = b.action_id
from (select action_id,count(*) phone from t_dest_phone group by action_id ) a, t_action b
where a.action_id = b.action_id
select a.action_id,a.action_name,
count(b.phone) as phone
from t_action a, t_dest_phone b where a.action_id = b.action_id group by a.action_id,a.action_name
from t_action a, t_dest_phone b
where a.action_id = b.action_id
group by a.action_id,a.action_name
楼主的sql查出的数据phone列的数据一定是一样的。
楼主的愿意可能是与3楼和4楼一样,按action_id和action_name分类汇总吧!
t_action a, (select action_id, count(phone) as phone from t_dest_phone) b
where a.action_id = b.action_id