【发布时间】:2020-01-03 04:07:33
【问题描述】:
这是我的数据集:
00000000040112 2702 00000000040112 AVAILABLE 1566921227223 -6.0 LB
00000000040112 2702 00000000040112 AVAILABLE 1566921247222 -9.0 LB
00030400791888 6065 00030400791888 AVAILABLE 1566919357992 45.0 EA
00030400791888 6065 00030400791888 AVAILABLE 1566919547809 72.0 EA
我正在尝试从每个组中获取最大值,因此根据上述数据,预期结果将是这样的:
00000000040112 2702 00000000040112 AVAILABLE 1566921247222 -9.0 LB
00030400791888 6065 00030400791888 AVAILABLE 1566919547809 72.0 EA
我没有产生正确结果的查询是:
select
primegtin, nodeid, gtin, inventory_state,
max(last_updated_time),
quantity_by_gtin, quantity_uom
from pit_by_prime_gtin
where
year=2019 and month =8 and day =27 and hour=15
group by
primegtin, nodeid, gtin, inventory_state,
last_updated_time,
quantity_by_gtin, quantity_uom ;
这可能有什么问题?
【问题讨论】:
-
嗨 Sumith - 有点不清楚,请您添加列名。另外,您的查询得到什么输出