I have the need to concatenate a string with a field value in a MySQL query in order to LEFT JOIN two tables.
Table one has a column called "category_id" with numeric values, such as 61, 78, 94 and such.
Table two has a column called "query" which refers to a request route mechanism, and it has values such as "product_id=68", "category_id=74", "manufacturer_id=99" and so on.
The sql to join these tables is as follows:
SELECT * FROM tableOne
LEFT JOIN tableTwo
ON tableTwo.query = concat(‘category_id=’,tableOne.category_id)
How do I set up a has many relationship like this? It is possible without lazy loading?