admin
Administrator
     
Offline
Posts: 239
|
 |
« on: January 26, 2022, 11:09: PM » |
|
if you have a field that show certain values multiple times yet you only want to know those values not all of the same values in the field then use the SELECT DISTINCT
lets say you have 10 records in a table have a column field - category and in that field 5 are RED and 5 are Blue values and you want a list of the type of values used then use the SELECT DISTINCT to show you just the different values - Red or Blue in the category field and not list all the values
SELECT DISTINCT category (this is the field) FROM models (this is the table)
SELECT DISTINCT it_sub_cat_name FROM it_sub_category ORDER BY it_category_id ASC
is how you'd write the mysql
|