mysql - Inner Join with LIKE, what is wrong? -


i have 2 tables

table 'prd_help_zusatz' id   title   art 1    text 1  material 2    text 2  material 3    text 3  farbe  table 'prd_produkt' id   prd_material ... 1    [1][2] 2    [2] 

the prd_material prd_produkt ids prd_help_zusatz in [] many materials chosen. give out possible values prd_help_zusatz materials used prd_produkt.

my select-code

select h.id  prd_help_zusatz h, prd_produkt p  h.art = 'material'    , p.prdart = 'uhr'    , h.id p.prd_material  group h.titel_d  

the problem is, on prd_material values not equal. how can select this? .. h.id '['p.prd_material']' doesn't work.

i suggest use query:

select *   prd_help_zusatz h join   prd_produkt p    on   p.prd_material concat('%', h.id, '%') ,        p.prdart = 'uhr' 

sql fiddle demo


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -