SELECT (count(*) FROM `bbs_thread` WHERE uid = 7) AS mythreads, (COUNT(*) FROM bbs_post WHERE uid = 7) AS myposts
第二种
SELECT (count(*) FROM `bbs_thread` WHERE uid = 7) AS mythreads, COUNT(*) AS myposts FROM bbs_post WHERE uid = 7
userid在两个表中都应该是唯一的吧,你group by是什么意思呀?如果需要获得结果的行数,可以使用select count(*) from table1 a,table2 b where a.userid=b.userid.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)