Jimmy Obonyo Abor
Jimmy Obonyo Abor

Reputation: 7875

Php Mysql select column with an associative array

I have a MySQL column with associative arrays. I'd like to create a select query where ["xyz":"somevalue"] below is how data is in the column :

{"abc":"0","xyz":"1"}

Upvotes: 0

Views: 153

Answers (1)

Barmar
Barmar

Reputation: 780889

Use LIKE to match it:

WHERE column LIKE '%"xyz":"somevalue"%'

It's a bad idea to store your data in JSON format like this if you need to be able to match it in queries. You should create an attribute table that contains each value as a separate row.

Upvotes: 2

Related Questions