id | group | text
1 | 1 | sadsd
2 | 1 | sdffs
3 | 1 | sdffs
4 | 2 | sdf
5 | 2 | sdfs
6 | 3 | sdfsdf
7 | 4 | 243
8 | 4 | dfgd
How can i get with SQL all group, but only one? I would like show:
group:
1
2
3
4
Other example:
id | group | text
1 | v | sadsd
2 | b | sdffs
3 | n | sdffs
4 | v | sdf
5 | v | sdfs
6 | n | sdfsdf
7 | m | 243
8 | b | dfgd
How can i get with SQL all group, but only one? I would like show:
group:
v
b
n
m
If you just want a list of all groups, you can use
SELECT DISTINCT ..If you want to select some additional data as well, you should use
GROUP BY