0

I have a mysql field which has a varchar value with the following format:

option-value, option-value, option-value

Here are 2 example tuple values:

"desk-4, table-2, bed-5"
"desk-2, bed-3, table-8, mattress-10"

I want to have a php-mysql query which can match and calculate (sum) the same products with their values from mutiple records, so that the result would be:

desk 6
table 10
bed 8
mattress 10 
GramThanos
  • 3,572
  • 1
  • 22
  • 34
P. Tzik
  • 133
  • 1
  • 3
  • 12

1 Answers1

0

You could just add this function to split a string in MySQL: https://stackoverflow.com/a/2696901/6441091

Then use SUM() and GROUP BY on the result.

Community
  • 1
  • 1
remborg
  • 528
  • 3
  • 14