select b.customer_id,b.service_num,b.user_passwd,b.service_type,c.cntNum
from ucs_subscription b inner join
(select a.customer_id,count(a.account_id) as cntNum
from ucs_account a
where a.region_id='D'
group by a.customer_id having count(a.account_id)<=2
) c
on b.customer_id=c.customer_id帮改改这个sql吧 求求了。执行结果cntNum总是1,可单独执行括号里的语句时cntNum的值不是1.
from ucs_subscription b inner join
(select a.customer_id,count(a.account_id) as cntNum
from ucs_account a
where a.region_id='D'
group by a.customer_id having count(a.account_id)<=2
) c
on b.customer_id=c.customer_id帮改改这个sql吧 求求了。执行结果cntNum总是1,可单独执行括号里的语句时cntNum的值不是1.
select a.customer_id,count(a.account_id) as cntNum
from ucs_account a
where a.region_id='D'
group by a.customer_id having count(a.account_id)=2