SQL SELECT DISTINCT Statement will allows you to avoid Duplicate Values while fetching data from database.
SELECT DISTINCT column_name FROM table_name
The "Persons" table:
P_Id City
1 Sandnes
2 Sandnes
3 Stavanger
Now we want to select only the persons living in the city "Sandnes" from the table above.
We use the following SELECT statement:SELECT * FROM Persons
WHERE City='Sandnes'
The result-set will look like this:
P_Id City
1 Sandnes
2 Sandnes
Tags :
Sql Tutorial
For Further Reading,
0 comments:
Post a Comment