My problem is: the products.cats field is like this: ["12"] or sometimes ["15", "12"]
However, the value of categories.id is always int. So Always 12 or 15
I want it to find one of the categories in the products.cats section (it doesn't matter) with an id value of 12 or 15. And I want to shoot with JOIN.
And I want to pull the ones whose category values are published.
But I can't do it with JOIN because products.cats value ["12"] has such a value.How can I map, check and join these 2 tables?
My Query:
SELECT *
FROM products
LEFT JOIN categories ON categories.id = products.cats
WHERE products.status='published'
AND categories.status='published'
ORDER BY products.created_at DESC
LIMIT 0,100
How can I sync them?