當前位置:首頁 » 編程語言 » 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

結果:

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:593
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:888
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:581
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:765
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:684
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1012
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:255
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:113
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:806
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:712