MySQL Join using "contains"? -
i have these 2 tables:
table: orders id - name - data --------------------------------------------- 1 - order 1 - node_checkout_nid";i:141;s:10: 2 - order 2 - node_checkout_nid";i:142;s:10: table: nodes nid - description -------------------- 141 - bla bla bla 142 - bla bla bla 2
i need sql join query can join 2 tables on nid, keeping in mind nid in "data" column.
i need end this:
table: result id - name - data nid - description ----------------------------------------------------------------------------------- 1 - order 1 - node_checkout_nid";i:141;s:10: - 141 - bla bla bla 2 - order 2 - node_checkout_nid";i:142;s:10: - 142 - bla bla bla 2
i wanted use "like" join, think (if it's possible) "contains" join better? appreciated!
you can use:
select id, name, data, nid, description orders inner join nodes on data concat('%;i:', nid, ';%')
anyway it's heavy query. it's not idea have nid inside data field plain text, better in different column.
Comments
Post a Comment