How to use DISTINCT OR GROUP BY return all columns?

Viewed 25

I'd like to distinct one colum but retuen all columns

The sql is basically this:

such as

SELECT a, DISTINCT (b), c FROM user 

I know it's not right or

SELECT a, b, c FROM user group by b 

my sqlMode="ONLY_FULL_GROUP_BY" So this also doesn't work

can I use

select *
from where b in (select distinct b from user)

or

select group_concat(distinct b),a , c from user group by b

is there any best solution or Any other help?

result: enter image description here

sample data: enter image description here

0 Answers
Related