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

解决方案 »

  1.   


    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
      

  2.   

    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
      

  3.   

    楼主的sql可能写错了。
    楼主的sql查出的数据phone列的数据一定是一样的。
    楼主的愿意可能是与3楼和4楼一样,按action_id和action_name分类汇总吧!
      

  4.   

    select a.action_id, a.action_name, b.phone from 
    t_action a, (select action_id, count(phone) as phone from t_dest_phone) b
    where a.action_id = b.action_id