讓我們說我有一個表像這樣:SQL名稱值
Store | Item | Price
store01 | Apple | 2.50
store01 | Pear | 3.00
store01 | Banana | 3.11
store02 | Apple | 2.50
store02 | Pear | 2.00
store03 | Banana | 3.10
,我只想一個查詢,列出該存儲中的所有商店和名最昂貴的項目。所以,我需要的是這樣的:
Store | Item
store01 | Banana
store02 | Apple
store03 | Banana
我試着像這樣:
SELECT "Store",
(case when (max ("Price") = "Price") then "Item" end) as "Max price Item"
FROM Table
group by "Price","Item","Store";
但這個結果就是:
Store | Max price Item
store01 | Apple
store01 | Pear
store01 | Banana
store02 | Apple
store02 | Pear
store03 | Banana
我上dashDB運行。
是否DashDB支持窗口的功能呢? –