Thank you for the detailed answer. This is very helpful. Turns out just adding UNIQUE solves my problem!