I have a table with a field similar to this:
ANIMAL
========
FISH 54
FISH 30
DOG 12
CAT 65
CAT 09
BIRD 10
FISH 31
DOG 10
New animals can be added to the field, such as
GOAT 72
DOG 20
What I would like to do is make a query SELECTthat returns one unique row for the name of the animal, returning a single row data set for the type of animal that I can later analyze to make a list of the animals present in my table.
So after magic I would have
FISH 54
DOG 12
CAT 65
BIRD 10
GOAT 72
... from which I would make my list.
So far I have been confused with subqueries SELECT DISTINCTand SUBSTRING(), but I feel that any result that I came up with is likely to be pale in comparison to the power of a reasonable SO skill. Can anyone help?
UPDATE
, , :
SELECT DISTINCT substring(animal,1,4) FROM table;
, .: (