select id,num from a union all select 'total',sum(sum) from a
select id,num from a union all select total,sum(sum) from a
SELECT qsj_user.email, qsj_user.telephone, qsj_user.regdate, qsj_user_profile.avatar, qsj_user_profile.nickname, qsj_user_profile.realname, qsj_user.uid FROM qsj_user LEFT JOIN qsj_user_profile ON qsj_user.uid = qsj_user_profile.uid WHERE qsj_user.role = 1 UNION SELECT COUNT(*) FROM qsj_user报错。 [Err] 1222 - The used SELECT statements have a different number of columnsUNION ALL 我也用过了。
union all合并下
union all
select 'total',sum(sum) from a
union all
select total,sum(sum) from a
qsj_user.email,
qsj_user.telephone,
qsj_user.regdate,
qsj_user_profile.avatar,
qsj_user_profile.nickname,
qsj_user_profile.realname,
qsj_user.uid
FROM qsj_user
LEFT JOIN qsj_user_profile
ON qsj_user.uid = qsj_user_profile.uid
WHERE qsj_user.role = 1
UNION
SELECT COUNT(*) FROM qsj_user报错。
[Err] 1222 - The used SELECT statements have a different number of columnsUNION ALL 我也用过了。