select a.dd-c.ff+b.ee from(selectcount(unionid) dd from move_user ) a,(selectcount(unionid) ee from move_user_channel) b,(selectcount(distinct unionid) ff from move_user_channel) c
SELECT
a.unionid,
a.NAME,
a.mobile,
FROM_UNIXTIME( a.create_time ),
b.openid,
b.app,
b.session_key,
b.gid,
b.extappid,
b.dist,
b.point,
b.total_point,
move_user_info.uid,
move_user_info.role,
move_user_info.STATUS,
move_user_info.nickname,
move_user_info.avatarurl,
move_user_info.gender,
move_user_info.country,
move_user_info.province,
move_user_info.city,
move_user_info.id_type,
move_user_info.id_number,
move_user_info.address,
move_user_info.reg_user_id,
move_user_info.jdid,
move_user_info.verifytime,
move_user_info.phone_token,
move_user_info.token_time,
move_user_info.validity,
move_user_info.logindays,
move_user_info.email,
move_user_info.birth,
move_user_info.appid,
move_user_info.login_type,
move_user_info.login_id,
move_user_info.district,
move_user_info.street
FROM(SELECT*FROM
move_user
WHERE
unionid ISNOTNULLLIMIT0,10) a
LEFTJOIN(SELECT
a.*FROM(SELECT
unionid,
openid,
app,
session_key,
gid,
extappid,
dist,point,
total_point,
create_time
FROM
move_user_channel
) a,(SELECT
unionid,max( create_time ) create_time
FROM
move_user_channel
WHERE
TRIM( unionid )IN(SELECT
unionid
FROM(SELECT unionid FROM move_user LIMIT0,10)AS t
)GROUPBY
unionid
) b
WHERE
a.unionid = b.unionid
AND a.create_time = b.create_time
) b ON a.unionid = b.unionid
LEFTJOIN move_user_info ON a.id = move_user_info.uid
LIMIT0,10