标签: mysql
使用Mysql如何将这两个命令合并为一个?
select id from User where name='name' select count(*) from Msg where user_id=@id
答案 0 :(得分:3)
您可以加入表格:
SELECT COUNT(*) FROM User a INNER JOIN Msg b ON a.id = b.user_id WHERE a.name = 'name'