SQL select distinct substring where like muddleup howto

后端 未结 4 1977
情书的邮戳
情书的邮戳 2021-01-02 17:47

I\'ve got a table with a field that is similar to this:

ANIMAL
========
FISH 54
FISH 30
DOG 12
CAT 65
CAT 09
BIRD 10
FISH 31
DOG 10

The fie

4条回答
  •  [愿得一人]
    2021-01-02 18:01

    You can also use the following to get your list of animal names:

    SELECT DISTINCT SUBSTRING_INDEX(animal, ' ', 1) FROM table_name;
    

提交回复
热议问题