希望这将很快得到答复。我是 SQL 新手,因此为此苦苦挣扎,我可能会遗漏一些明显的东西。我有以下查询,它在单独的结果中返回行数,但是我想将结果放入 XLS。实现这一目标的最佳方法是什么?
select count(*) as "table_1" FROM table_1
select count(*) as "table_2" FROM table_2
select count(*) as "table_3" FROM table_3
select count(*) as "table_4" FROM table_4
select count(*) as "table_5" FROM table_5
select count(*) as "table_6" FROM table_6
select count(*) as "table_7" FROM table_7
select count(*) as "table_8" FROM table_8
select count(*) as "table_9" FROM table_9
select count(*) as "table_10" FROM table_10
非常感谢!
感谢您的帮助,这就是我给我所需的东西。
我知道这将是相当简单的事情!
SELECT 'table_1' as "Table", count (*) as "Count" FROM table_1 union all
SELECT 'table_2' as "Table", count (*) as "Count" FROM table_2 union all
SELECT 'table_3' as "Table", count (*) as "Count" FROM table_3 union all
SELECT 'table_4' as "Table", count (*) as "Count" FROM table_4 union all
SELECT 'table_5' as "Table", count (*) as "Count" FROM table_5 union all
SELECT 'table_6' as "Table", count (*) as "Count" FROM table_6 union all
SELECT 'table_7' as "Table", count (*) as "Count" FROM table_7 union all
SELECT 'table_8' as "Table", count (*) as "Count" FROM table_8 union all
SELECT 'table_9' as "Table", count (*) as "Count" FROM table_9 union all
SELECT 'table_10' as "Table", count (*) as "Count" FROM table_10