tags:

views:

33

answers:

1
+2  A: 

I would think something like

WHERE ? LIKE concat(leadin, '%') order by length(leadin) desc limit 1

(I haven't checked the function names, and I'm not certain that this will work in MYSQL - I'm pretty sure it will work in one of the SQL's I've used).

Colin Fine
Blimey that's clever - never thought of reversing where to be where <arg>, and concat with % is brilliant. Very quick, seems spot on. Thank you.
WaveyDavey