Php – thesql select count with another select count

databaseMySQLPHPselect

how can i combine these two queries in mysql?

 select count(*) as entry_count from tbl_entries where user_id = x

and

select username, avatar from tbl_users where user_id = x

I want one result that combines the result of this 2 queries. Please help me guys!

Thanks!

Best Answer

select username, 
       avatar,
       (select count(*) from tbl_entries where user_id = x) as entry_count
from tbl_users 
where user_id = x