I'm trying to solve a problem in SQL but without much success so far. I have a table like this:
OWNER|STORE|DATE
A | MIX |01/01/2019
A | BIX |01/01/2019
A | BIX |02/01/2019
B | CIX |01/01/2019
B | CIX |02/01/2019
It's a table showing information about owners and their stores. An owner can have a store during a month, but this store could be gone in the next month. Or, their store could be present in january, but gone in february.
I wanted to find a way to flag this store movement, so if a store is present in january, and gone in february, I would flag a colum as "gone". And if a store was not present in january, but appeared in february, I would flag it as "new".
Can anyone help me with that? Thanks!