Extracting unique values from the cells of the mass. Flower extraction
-
Got it. https://yadi.sk/i/hTvxtklNmM6ZU
The table is linked to the table of goods. Stopped on this table of parameters. Maybe she's incorrect or she's going to be uncomfortable in the future, and she's interested in hearing the views of experienced people. The point is, I want to take out the parameters, starting with the color. We need to pick up all the color identifiers from the column.
color_id
for certain goodsitem_id
♪ I mean, there may be a few matching color identifiers for a certain product, but one must be selected. For example, in the above table all valuescolor_id
- 1.1,2.3 - need to pull 1.2,3. If it's 1.1,1,2,3,4,4,4,5,5, pull 1.2,3,4,5. There's probably a pattern of work with a sample of colors that's more comfortable, but I haven't figured it out yet.
-
You're gonna have to do a subpoena to identify unique elements first, and then group.
drop table if exists t; create table t (id int, item int, color int); insert into t values (1,1,1), (2,1,1), (3,1,2), (4,1,3);
select item, group_concat(color) from (select distinct item, color from t) t1 group by item
result
item group_concat(color)
1 1,2,3