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

結果:

熱點內容
python保留小數 發布:2025-07-01 06:45:34 瀏覽:754
為什麼伺服器有多個ip地址沖突 發布:2025-07-01 06:32:09 瀏覽:623
java的md5演算法實現 發布:2025-07-01 06:23:09 瀏覽:235
android默認的activity 發布:2025-07-01 06:06:12 瀏覽:421
青浦智能密碼鎖開鎖多少錢 發布:2025-07-01 06:02:42 瀏覽:441
編譯內核生成 發布:2025-07-01 05:48:23 瀏覽:618
咖啡壓縮糖 發布:2025-07-01 05:43:58 瀏覽:581
雲搜卡源碼 發布:2025-07-01 05:32:38 瀏覽:543
華為伺服器怎麼查ip 發布:2025-07-01 05:15:18 瀏覽:373
編譯器中的數據結構 發布:2025-07-01 05:10:53 瀏覽:529