add remove split language show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
version()
8.0.30
Records: 6  Duplicates: 0  Warnings: 0
Records: 4  Duplicates: 0  Warnings: 0
Records: 4  Duplicates: 0  Warnings: 0
@@sql_mode
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
product_code product_id assign_key GROUP_CONCAT(t2.value_name)
GHI 2 10 null
DEF 2 10,28 null
HIJ 1 23 null
ABC 1 23,45 null
NOP 2 28 null
KLM 1 45 null
product_code product_id assign_key GROUP_CONCAT(t2.value_name)
GHI 2 10 null
DEF 2 10,28 null
HIJ 1 23 null
ABC 1 23,45 null
NOP 2 28 null
KLM 1 45 null
product_id product_code FIND_IN_SET(a.assign_id,p.assign_key) assign_key v value_id value_name
1 ABC 2 23,45 45 2 Large
1 ABC 1 23,45 23 1 Red
1 HIJ 1 23 23 1 Red
1 KLM 1 45 45 2 Large
2 DEF 2 10,28 28 4 Small
2 DEF 1 10,28 10 3 Blue
2 GHI 1 10 10 3 Blue
2 NOP 1 28 28 4 Small
product_id product_code AssignIDs ValueIDs Values
1 ABC 45,23 2,1 Large,Red
1 HIJ 23 1 Red
1 KLM 45 2 Large
2 DEF 28,10 4,3 Small,Blue
2 GHI 10 3 Blue
2 NOP 28 4 Small
product_id product_code AssignIDs ValueIDs Values
1 ABC 23,45 1,2 Red,Large
1 HIJ 23 1 Red
1 KLM 45 2 Large
2 DEF 10,28 3,4 Blue,Small
2 GHI 10 3 Blue
2 NOP 28 4 Small