If you have same data on the database table and you want to avoid duplication in your query result then you can use distinct word in mysql query to avoid duplication.
Example Table : For your reference
table_name
The table table_name contains four column data but the column_name4 has 2 sam and 2 Jam but i want to avoid sam and Jam with single results.
Query : "SELECT DISTINCT Column_name4 from table_name"
If you execute the above query then the duplicate data from Column_name4 will be filtered.
table_name
table_name
Column_name1 | Column_name2 | Column_name3 | Column_name4 |
1 | Tech | articles | Sam |
2 | Mysql | database | Sam |
3 | Java | coding | Jam |
4 | J2ee | coding | Kam |
5 | Hibernate | coding | Jam |
Table Name is : table_name
The table table_name contains four column data but the column_name4 has 2 sam and 2 Jam but i want to avoid sam and Jam with single results.
Query : "SELECT DISTINCT Column_name4 from table_name"
If you execute the above query then the duplicate data from Column_name4 will be filtered.
table_name
Column_name4 |
Sam |
Jam |
Kam |
Comments
Post a Comment