I'm writing a query with a filter based on a string inside the field. However and I'm running the query it shows the error:
Left side of LIKE expression must evaluate to a varchar
I want to fFilter by everyone who bought a BMW based on a custom_field.
This is the sample data that is inside the custom field:
{ "car_model;":"BMWZ4", "car_id":"0980291", "manufacture":"bmw" }
Code:
SELECT
first_name,
Last_name,
country,
custom_field
FROM
sales_table
WHERE
custom_field LIKE '%BMWZ4%'
Expected result
first_name: John
last_name: Parker
country: Germany
custom_field: {"car_model;":"BMWZ4","car_id":"098222291","brand":"bmw"}