我有一个表,其中包含一个名为“数据”的列,其中包括:
{"id":1074,"opened":true,"subscribed":true}
我想要一个按这些属性过滤的查询。
我试过了
->whereRaw('JSON_EXTRACT(data, "$.opened")', false)
和
->where('data->opened', false)
回复:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '>'$."id"' = ? and `data`->'$."opened"' = false order by `created_at` desc' at line 1 in.....
我知道此代码适用于 MySQL 5.7,但我的服务器正在运行“10.1.34-MariaDB-0”,我无法更改为 MySQL,因为 Plesk 不支持它。