Andrea Bandiera
Andrea Bandiera

Reputation: 109

Retrieve how many types are in a column

I have a db with this data

"id" , "desc"                        , "tipo"
"37" , "Acai Tropitalia Surgelato"   , "Frutta"
"38" , "Acerola Tropitalia Surgelata", "Frutta"
"1"  , "Aceto Balsamico"             , "Liquido"
"187", "Aceto di Mele BIO"           , "Liquido"
"2"  , "Acido Citrico"               , "Solido"
"3"  , "Acqua"                       , "Liquido"
"39" , "Albicocca Fresca"            , "Frutta"

and i would like to know how many "tipo" are in the table, for examples the query in this table return

"tipo"
"Frutta"
"Liquido"
"Solido"

how can create the query?

Upvotes: 0

Views: 31

Answers (1)

Szymon
Szymon

Reputation: 43023

You can just use distinct keyword to return a distict list of tipo column values:

select distinct tipo from mytable

Upvotes: 1

Related Questions