I have following query in my php code
SELECT count(t1.cat) as count,t2.cat as cat, t2.id as id, t1.mcat as mid FROM t2,t1 WHERE t2.name LIKE '%$Name%' and t1.id = t2.cat and t2.phone LIKE '$AreaCode%' group by t2.subcat order by t2.id,t1.cat
Now I know this query will not use index on t2.name column since i am using wild card for '%$Name%'. But I need to use wild card cause I need to find a string that contains search word and not begins with search word.
Is there any other work around for this?
Thanks
PP
SELECT count(t1.cat) as count,t2.cat as cat, t2.id as id, t1.mcat as mid FROM t2,t1 WHERE t2.name LIKE '%$Name%' and t1.id = t2.cat and t2.phone LIKE '$AreaCode%' group by t2.subcat order by t2.id,t1.cat
Now I know this query will not use index on t2.name column since i am using wild card for '%$Name%'. But I need to use wild card cause I need to find a string that contains search word and not begins with search word.
Is there any other work around for this?
Thanks
PP