Project / Support Center
Welcome, %1$s. Please login or register. February 28, 2024, 11:33: AM
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  MySQL  |  : Showing the distinct values in a field 0 and 1 Guest are viewing this topic. « previous next »
: [1]
: Showing the distinct values in a field  ( 3795 )
admin
Administrator
******


: 239


« : 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
« : May 19, 2023, 07:19: PM admin »  

The Unknown Webmaster
: [1]  
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  MySQL  |  : Showing the distinct values in a field « previous next »
:  


Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!
Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.