1

I would like to get customers table based on 2 conditions, but the customers table has the customer_group value stored in JSON format.

customers table

id,name,customer_group,address
1,Test,["1","2"],Address

customer_group table

id,group_name,code
1,Group 1,type1
2,Group 2,type2

query:

SELECT *.customers
  FROM customers
  INNER JOIN customer_group ON customer_group.id=customers.customer_group
  WHERE customer_group.code = type1 OR customer_group.code = type2
  GROUP BY customers.id;

is there a way to extract first the customer_group values in json and then pass to the query?

ndAR
  • 371
  • 2
  • 4
  • 15

0 Answers0