sql - Why does my LIKE filter only match on one value? -
i have this excel file giving me unexpected results on sql query join on like criteria. 
here sql statement:
select co.materials, co.sizes, co.tools, ir.pn, ir.bodyjaw   `crossjoin$` co left join `inserts$` ir       on co.tools=ir.tool     , ((ir.material '%'+co.materials+'%'))     , ((ir.size '%'+co.sizes+'%'))   and issue is, criteria ir.material only match on 1 value "333".  can't figure out.  here's visual explanation of what's happening (in case don't want download file): 
the other 2 filters work fine, separately or in combination, , matches come expected.  it's material field giving me heartburn.  if delete other 2 filters out of sql statement, still matches on records material "333" , if delete material left table, no matches @ all. 
does know cause behavior? sanity check, tried vlookup in excel on these tables , matched material without problem, data right , match.
it's interesting 333 matches. 
i think what's happening first values excel seeing in material columns 333, it's inferring column type integer value, limit potential matches other integer values.
you test theory fudging other material codes -- make "444" or in each worksheet , see if matches. if that's case, ensure datatypes of columns want them (all text, assume).
alternatively, adding imex=1 connection string might easier -- make excel data reader treat data strings.

Comments
Post a Comment