two SQL COUNT() queries?

前端 未结 5 440
时光取名叫无心
时光取名叫无心 2020-12-16 19:03

I want to count both the total # of records in a table, and the total # of records that match certain conditions. I can do these with two separate queries:

S         


        
5条回答
  •  我在风中等你
    2020-12-16 19:47

    In Oracle SQL Developer I had to add a * FROM in my select, or else i was getting a syntax error:

    select * FROM 
        (select COUNT(*) as foo FROM TABLE1),
        (select COUNT(*) as boo FROM TABLE2);
    

提交回复
热议问题