MySQL get list of unique items in a SET
Posted
by The Disintegrator
on Stack Overflow
See other posts from Stack Overflow
or by The Disintegrator
Published on 2010-04-11T06:38:47Z
Indexed on
2010/04/11
6:43 UTC
Read the original article
Hit count: 443
I have a products table with a column of type SET (called especialidad), with these possible values.
[0] => NADA
[1] => Freestyle / BMX
[2] => Street / Dirt
[3] => XC / Rural Bike
[4] => All Mountain
[5] => Freeride / Downhill / Dual / 4x
[6] => Ruta / Triathlon / Pista
[7] => Comfort / City / Paseo
[8] => Kids
[9] => Playera / Chopper / Custom
[10] => MTB recreacion
[11] => Spinning / Fitness
Any given product can have one or many of these i/e "Freestyle / BMX,Street / Dirt" Given a subset of the rows, I need to get a list of all the present "especialidad" values. But I need a list to be exploded and unique
- Article1: "Freestyle / BMX,Street / Dirt"
- Article2: "Street / Dirt,Kids"
- Article2: "Kids"
- Article4: "Street / Dirt,All Mountain"
- Article5: "Street / Dirt"
I need a list like this
- Freestyle / BMX
- Street / Dirt"
- Kids"
- All Mountain"
I tried with group_concat(UNIQUE) but I get a list of the permutations...
© Stack Overflow or respective owner