Multiply the number of elements from two different tables

3

I have two tables: pessoas and carros .

I would like to take the number of elements of both tables, and multiply them.

    
asked by anonymous 12.08.2016 / 19:03

2 answers

3

I think this is what you want:

SELECT a.c * b.d AS produto
FROM (SELECT COUNT(*) AS c FROM pessoas) a,
     (SELECT COUNT(*) AS d FROM carros) b
    
12.08.2016 / 19:17
2
select 
    (select count(*) from pessoas) *
    (select count(*) from carros)
    
14.08.2016 / 15:10