New to the site but I have a snapshot of a query that doesn't work and I can't get my head around why.
type 5 is a call, type 0 is a note (but could be a call due to record keeping) so I'm trying to find = type 5 or (type 0 where the clients name is within the note).
Below is the section that fails
AND (ct.tpe = 5 OR (ct.tpe = 0 AND ct.smmry LIKE ('%', c.frstnme1 ,'%')))
This works if I replace c.frstnme1
with the actual name in that field, but it won't work with the request for the information from c.frstnme1
. I don't get this as there can only be one item of info in c.frstnme1
and the table is already linked as "FROM c, ct WHERE ct.cse = c.id
" so it shouldn't be trying to find other first names. But again it works with the exact same query but with the actual name typed. Any help please!
Thanks Will