让我们说我有一个表像这样: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支持窗口的功能呢? –