Column actions_serialized contains the following value:
a:7:{s:4:"type";s:40:"salesrule/rule_condition_product_combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"any";s:10:"conditions";a:3:{i:0;a:5:{s:4:"type";s:32:"salesrule/rule_condition_product";s:9:"attribute";s:3:"sku";s:8:"operator";s:2:"==";s:5:"value";s:17:"SKU-ABC1";s:18:"is_value_processed";b:0;}i:1;a:5:{s:4:"type";s:32:"salesrule/rule_condition_product";s:9:"attribute";s:3:"sku";s:8:"operator";s:2:"==";s:5:"value";s:76:"SKU-ABC203";s:18:"is_value_processed";b:0;}i:2;a:5:}}}
Now I need to fetch all SKUs in a separate line.
So I have the following query but it only returns the first instance of the SKU occurrence.
How do I get all other occurrences, and then how would I split them into a separate line?
Note, SKU occurrences may sometimes add up to 10+ SKUs.
select
sr.id,
group_concat(distinct substring(sr.actions_serialized,
locate('sku', sr.actions_serialized)+47,
locate(';s:18:"is_value_processed";b', sr.actions_serialized)-
locate('sku', sr.actions_serialized)-48)) skus
from from salesrule sr
group by sr.id
Above query returns only first instance of SKU. But desired results are:
id skus
1 SKU-ABC1
1 SKU-ABC203
If not possible, then at least:
id skus
1 SKU-ABC1,SKU-ABC203