0

Using Mysql How would i merge these two commands into one?

select id from User where name='name' select count(*) from Msg where user_id=@id 

1 Answer 1

3

You can join the tables:

SELECT COUNT(*) FROM User a INNER JOIN Msg b ON a.id = b.user_id WHERE a.name = 'name' 
Sign up to request clarification or add additional context in comments.

Comments