I have a table structure like this:
|ID | Country | League |
| 0 | Germany | B1     |
| 1 | Germany | B2     |
| 2 | Italy   | A      |
How can I get Germany only once with a query? I would like something like this:
Germany, Italy.
I have a table structure like this:
|ID | Country | League |
| 0 | Germany | B1     |
| 1 | Germany | B2     |
| 2 | Italy   | A      |
How can I get Germany only once with a query? I would like something like this:
Germany, Italy.
 
    
     
    
    Either select distinct values
select distinct country 
from your_table
or group by the value that should be unique
select country 
from your_table 
group by country
 
    
    You can just do this:
SELECT DISTINCT country FROM some_table
This will give you all countries only once.
If you want all country names in a single result, you can use GROUP_CONCAT():
SELECT
    GROUP_CONCAT(DISTINCT country ORDER BY country DESC SEPARATOR ',') AS country_list
FROM some_table
