Possible Duplicate:
Can Mysql Split a column?
Mysql string split
I have this in a table:
id color
1 red/green/blue/orange
2 blue
3
4 red/green
I will a sql query maybe this :
color
red
green
blue
orange
blue
red
green
Possible Duplicate:
Can Mysql Split a column?
Mysql string split
I have this in a table:
id color
1 red/green/blue/orange
2 blue
3
4 red/green
I will a sql query maybe this :
color
red
green
blue
orange
blue
red
green
What the commenters want to suggest, is splitting the values into separate rows:
id color
1 red
1 green
1 blue
1 orange
2 blue
3 NULL
4 red
4 green
Then you can easily select:
select color from color_table;
or every color only once:
select distinct color from color_table;