Select 许多列基于多列中的最低值(毫秒访问)
Select many columns based on lowest value from multiple columns (ms access)
我搜索了 google 但没有成功,可能是由于我的搜索查询。
我有一个 table 如下所示
------------------------------------------------------------
| LocalID | ASIN | Price | Shipping | Total | Currancy |
------------------------------------------------------------
| 1 |B01MSMCN13 | 95.99 | 3 | 98.99 | GBP |
------------------------------------------------------------
| 2 |B01MSMCN13 | 100 | 0 | 100.0 | GBP |
------------------------------------------------------------
| 3 |B01MSMCN13 | 104.71| 9.61 | 114.32| GBP |
------------------------------------------------------------
| 4 |B01MSMCN13 | 124.81| 8.95 | 133.76| GBP |
------------------------------------------------------------
| 5 |B073WDMZVT | 139.99| 0 | 139.99| GBP |
------------------------------------------------------------
| 6 |B073WDMZVT | 159 | 0 | 159.0 | GBP |
------------------------------------------------------------
| 7 |B073WDMZVT | 179 | 0 | 179 | GBP |
------------------------------------------------------------
问题:
我想根据最低价格+运费获取所有列
我想要的结果是这样的
------------------------------------------------------------
| LocalID | ASIN | Price | Shipping | Total | Currancy |
------------------------------------------------------------
| 1 |B01MSMCN13 | 95.99 | 3 | 98.99 | GBP |
------------------------------------------------------------
| 5 |B073WDMZVT | 139.99| 0 | 139.99| GBP |
------------------------------------------------------------
我尝试了很多查询,但无法得到想要的结果。
非常感谢您的帮助。
使用最小函数和分组依据
SELECT *
FROM Table t
WHERE Total = (SELECT MIN(Total)
FROM Table t2
WHERE t.ASIN = t2.ASIN
GROUP BY ASIN)
我搜索了 google 但没有成功,可能是由于我的搜索查询。
我有一个 table 如下所示
------------------------------------------------------------
| LocalID | ASIN | Price | Shipping | Total | Currancy |
------------------------------------------------------------
| 1 |B01MSMCN13 | 95.99 | 3 | 98.99 | GBP |
------------------------------------------------------------
| 2 |B01MSMCN13 | 100 | 0 | 100.0 | GBP |
------------------------------------------------------------
| 3 |B01MSMCN13 | 104.71| 9.61 | 114.32| GBP |
------------------------------------------------------------
| 4 |B01MSMCN13 | 124.81| 8.95 | 133.76| GBP |
------------------------------------------------------------
| 5 |B073WDMZVT | 139.99| 0 | 139.99| GBP |
------------------------------------------------------------
| 6 |B073WDMZVT | 159 | 0 | 159.0 | GBP |
------------------------------------------------------------
| 7 |B073WDMZVT | 179 | 0 | 179 | GBP |
------------------------------------------------------------
问题:
我想根据最低价格+运费获取所有列
我想要的结果是这样的
------------------------------------------------------------
| LocalID | ASIN | Price | Shipping | Total | Currancy |
------------------------------------------------------------
| 1 |B01MSMCN13 | 95.99 | 3 | 98.99 | GBP |
------------------------------------------------------------
| 5 |B073WDMZVT | 139.99| 0 | 139.99| GBP |
------------------------------------------------------------
我尝试了很多查询,但无法得到想要的结果。
非常感谢您的帮助。
使用最小函数和分组依据
SELECT *
FROM Table t
WHERE Total = (SELECT MIN(Total)
FROM Table t2
WHERE t.ASIN = t2.ASIN
GROUP BY ASIN)