select mc.catid, mc.slug_url, case when mp.active = 't' and mp.webenabled = 't' then 't' when mp.active = 'f' or mp.webenabled = 'f' then 'f' end itemactive from mt360peak_products mp join mt360peak_category mc on mc.catid = mp.categoryid where mp.itemno='ls2-csah-2' : Type mismatch