SQL - how to get unique values in a column (distinct does not help here)
问题 I have a production case where we track devices that move around warehouses. I have a table that shows these previous locations like this: +--------+------------+-----------+------+ | device | current_WH | date | rank | +--------+------------+-----------+------+ | 1 | AB | 3/15/2018 | 7 | | 1 | CC | 3/19/2018 | 6 | | 1 | CC | 3/22/2018 | 5 | | 1 | CC | 3/22/2018 | 5 | | 1 | DD | 4/23/2018 | 4 | | 1 | DD | 5/11/2018 | 3 | | 1 | DD | 5/15/2018 | 2 | | 1 | DD | 5/15/2018 | 2 | | 1 | AA | 6/6