Skip to content
Advertisement

SQL QUERY to show records of names that are recorded several times and are unique towards each other

For example, let us consider this table: In this image consists of rows of 8 where names like Mike,Glenn,Daryl,Shane and Patricia is included with their respective ages

Id Name Age
1 Mike 25
2 Glenn 19
3 Glenn 19
4 Daryl 56
5 Shane 30
6 Shane 30
7 Patricia 16

Now I want to insert the type of query that will show the names without repetitions like This, not like This

EDIT: I entered the data from first picture. The request is to list the names without duplicates, as shown in the second and third picture but I will not convert them to text.

Advertisement

Answer

DISTINCT specifies removal of duplicate rows from the result set.

SELECT DISTINCT Name
FROM tablename

see: use DISTINCT in SELECT

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement