So, let's say I have this data:
store_name | latitude | longitude | store_id | same_location_count | same_location_store_id
SR Restaurant and Cafe | -41.575449 | 147.16824 | 1112 | 0 | null
Big Bite Burgers | -41.575449 | 147.16824 | 1113 | 0 | null
Amigos | -41.575449 | 147.16824 | 1114 | 0 | null
Domino's | -38.33983 | 143.58384 | 1115 | 0 | null
I want to identity the stores that are in same coordinates.
The expected result looks like this:
store_name | latitude | longitude | store_id | same_location_count | same_location_store_id
SR Restaurant and Cafe | -41.575449 | 147.16824 | 1112 | 2 | 1113:1114
Big Bite Burgers | -41.575449 | 147.16824 | 1113 | 2 | 1112:1114
Amigos | -41.575449 | 147.16824 | 1114 | 2 | 1112:1113
Domino's | -38.33983 | 143.58384 | 1115 | 0 | null
If the stores are in same coordinates, we increment the same_location_count
and get the ID of the same store location and concatenate it to same_location_store_id
.