Hi all,

Am having trouble trying to retrieve records using the following SQL statement:

SELECT distinct(dbS.tCline.mobile),dbS.tCline.msg,dbS.tCline.dest,
dbS.tCline.reply,dbS.tCline.status
FROM dbS.tCline,dbLaw.FORMER_GREY
where dbS.tCline.msg LIKE '%'||dbLaw.FORMER_GREY.C||'%' and
dbS.tCline.msg like '%ADMISSION%'

My problem now is that, the resultset retrieved includes everything from dbLaw.FORMER_GREY.C instead of only those rows that match dbS.tCline.msg rows.Please assist and be sure that your help is much appreciated.
Thank you in advance

Here is the full-proof solution:

select distinct(s.mobile),s.msg,r.C,s.dest,
s.reply,s.status from dbS.tCline s
INNER JOIN dbLaw.FORMER_GREY r ON s.msg LIKE concat('%',concat(r.C,'%')) where s.msg like '%ADMISSION%'

Many thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.