-2

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.
Anonymous
  • 10,357
  • 3
  • 37
  • 49
Salvatore Fucito
  • 255
  • 1
  • 12

2 Answers2

0

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
juergen d
  • 186,950
  • 30
  • 261
  • 325
0

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
Anonymous
  • 10,357
  • 3
  • 37
  • 49