0

Is it possible to pull counts from two tables that are not joined?

For example:

SELECT
     (SELECT COUNT(PERSON) FROM PEOPLE),
     COUNT(BUILDINGS)
FROM 
     BUILDINGS

I get an error saying:

not a single-group group function.

Stivan
  • 1,128
  • 1
  • 15
  • 24
mjanach
  • 85
  • 1
  • 9

1 Answers1

0

One way to do it is by moving both count queries in the select clause:

select
  (SELECT COUNT(*) FROM PEOPLE) people_cnt,
  (SELECT COUNT(*) FROM BUILDINGS) building_cnt
from dual
sstan
  • 35,425
  • 6
  • 48
  • 66