mysql - Multi count from multi table in SQL -
i have following table example:
table users
:
|id |user | | 1 |frank | | 2 |tom | | 3 |lisa |
table cities
:
|id |city | | 1 |paris | | 2 |tokyo |
how can have count of each table users
, cities
in 1 sql query ?
i want have:
- number of users: 3
- number of cities: 2
thanks.
just guessing mean:
select (select count(*) users) user_count, (select count(*) cities) city_count
in general, can use subquery place expression allowed, long subquery returns 1 row 1 column, wrapping subquery in parentheses.
Comments
Post a Comment