I have table in MySql where I have column type
in this column type are different types
each row in table have type,
how to get list of those values ( not repeating = DISTINCT) ?
example:
id name type
-------------------
1 apple fruit
2 onion vegetable
3 banana fruit
List:
fruit
vegetable
Idea:
SELECT `type` FROM `food` WHERE ...
In order to get distinct Data You Use DISTINCT
SELECT DISTINCT TYPE FROM FOOD
You need to use having clause.
SELECT type FROM food GROUP BY type;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With