I am doing my first experiences with sql. I am currently working on a genealogical website feeded by an sql database. By the time the number of persons in the db has increased an I want to implement a short way to navigate to a specific person by a few clicks. Therefore, I want to first give a list of all family names within the database. The sql for this is quite simple:
SELECT familyname FROM tablewithdata ORDER BY familyname;
This obviously gives me a list like this:
- Griffin
- Griffin
- Griffin
- Miller
- Miller
- Miller
- Sanchez
- Sanchez
- Simpson
- Simpson
- Simpson
- Simpson ...
The occurrences of the family names are as much as the individuals with this name in the db.
But I want to have only one occurrence of each family name in the database like this:
- Griffin
- Miller
- Sanchez
- Simpson
I hope there is a simple solution for my request. My Google search only resulted in ways I can remove the double entries from my database.
Thank you very much for your help!!