And if they actually live in two apartments that are beside each other it might be that there should be two labels:
Bob Smith
123 Main Street
City, ST 12345
and
Sue Smith
123 Main Street
City, ST 12345
Then there may be these two rows as well, the address are not quite the same but it should be:
Bob Smith at 123 Main Street 3rd floor, City, ST 12345.
Sue Smith, at 123 Main Street, City, ST 12345.
To be sure that it gets right every time you need to have information about who lives with who in the database. Maybe you think that it is impossible to handle it without this extra information. But it is possible, you "only" have to decide what rules should apply to let people live together.
Let's assume that you have decided that the exact same address means that people live together. There are many ways to handle this, but I think that the best is to get all information (name, street, city and code) from the database ordered by street, city and code. When deciding if it is a new address or not you check if street, city and code is the same, if it is then it is the same address. And then you need to handle the names in a good way.
It is not as difficult as you might think. Start with one case and when that works go to the next case and you will get the hang of it.