Missing distinct in SQL for deck matching