我必須包含以下表格:計數的Oracle SQL
Fruit_id Fruit1 Fruit2
-------------------------------------
1 Apple Orange
2 Orange Orange
3 Orange Orange
4 Banana Banana
5 Apple Orange
我想計數每個水果的總數,這樣的輸出是一樣的東西
Fruit Frequency
---------------------------
Apple 2
Banana 2
Orange 6
我曾嘗試
select distinct Fruit1, count(Fruit1 Fruit2) from Fruits group by Fruit1 order by count(Fruit1 Fruit2);
我也試過:
select distinct Fruit1, count(Fruit1 || Fruit2) from Fruits group by Fruit1 order by count(Fruit1 Fruit2);
我是新來的Oracle SQL所以請理解我的無知
作品!非常感謝。 – user3619807