0

I have different MySQL tables such as users, news and etc. I want to know users number, news number with one MySQL query. How can I do that?

Someone
  • 736
  • 2
  • 12
  • 29

1 Answers1

0

Use a UNION.

SELECT 'users', COUNT(*) as c FROM users UNION SELECT 'names', COUNT(*) as c FROM names;

tdammers
  • 20,353
  • 1
  • 39
  • 56