你是說所有表的總記錄數(shù)嗎?給你個(gè)樣例你看下有沒有幫助
成都創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供繁峙網(wǎng)站建設(shè)、繁峙做網(wǎng)站、繁峙網(wǎng)站設(shè)計(jì)、繁峙網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、繁峙企業(yè)網(wǎng)站模板建站服務(wù),十年繁峙做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
SELECT p.object_id,OBJECT_NAME(p.object_id),p.rows,t.*
FROM sys.partitions AS p
INNER JOIN sys.tables AS t ON p.[object_id] = t.[object_id]
INNER JOIN sys.schemas AS s ON t.[schema_id] = s.[schema_id]
WHERE p.index_id IN (0, 1)
AND t.type='U'
SqlServer中這樣統(tǒng)計(jì):
select name from sysobjects where xtype='U'
要知道總數(shù)的話就簡(jiǎn)單了:
select count(*) from sysobjects where xtype='U'
Oracle中這樣查詢:
Select * From user_tables;
可以有兩種解決方法,
所需工具:SQL
查詢兩個(gè)count的方法1:
SELECT paperName , COUNT (1) AS 總題數(shù) , sum (CASE WHEN statu = 1 THEN 1 ELSE 0 END) AS 審核題數(shù)FROM questionGROUP BY paperNme
查詢兩個(gè)count的方法2:
select s.總題數(shù), s.審核題數(shù), s.paperNamefrom (select COUNT(1) as 總題數(shù), case when status = 1 then count(1) else 0 end as 審核題數(shù), paperNamefrom question--where papername in (select distinct paperName from question), 這個(gè)條件可以不要了group by paperNme, stauts -- status也要作為分組字段,因?yàn)樵赾ase中有使用) s