當前位置:首頁 » 編程語言 » oraclesql統計

oraclesql統計

發布時間: 2025-07-01 01:28:37

Ⅰ 在oracle中用一條sql語句統計a欄位下值為b的數據條數,值為c的數據條數並返回

select 'b',count(a) from 表名 where a='b'
union
select 'c',count(a) from 表名 where a='c';
這樣寫試一下,看看是否好用。

Ⅱ 求Oracle分組統計數量的sql怎麼寫,需求如下

造了點數據,不知道是這個意思不

createtabletest
(totalint,
ssbmvarchar2(20));

insertintotestvalues(5,'02(5)');
insertintotestvalues(5,'02(5)');
insertintotestvalues(5,'04(5)');
insertintotestvalues(5,'04(5)');
insertintotestvalues(5,'03(5)');

commit;

查詢:

selectssbm||'('||cnt||')'from(selectsubstr(ssbm,1,instr(ssbm,'(')-1)ssbm,count(*)cntfromtestgroupbysubstr(ssbm,1,instr(ssbm,'(')-1))t

結果:

熱點內容
php微信開發教程 發布:2025-07-01 10:28:24 瀏覽:840
訪問學者聯系導師 發布:2025-07-01 10:27:44 瀏覽:982
伺服器端的http地址 發布:2025-07-01 10:04:35 瀏覽:176
php好處 發布:2025-07-01 10:01:45 瀏覽:877
安卓車機什麼屏幕好 發布:2025-07-01 09:46:15 瀏覽:546
編譯原理re不能描述的串 發布:2025-07-01 09:34:24 瀏覽:75
本地電腦怎麼用伺服器ip 發布:2025-07-01 09:10:03 瀏覽:831
有趣的python代碼 發布:2025-07-01 09:10:02 瀏覽:361
威龍奇兵ftp 發布:2025-07-01 09:07:38 瀏覽:694
linuxedit 發布:2025-07-01 09:03:36 瀏覽:424