Select * from fileone one where exists
(select 1 from namefile nf where lower(one.uptext) like nf.srchname)
Senior Programmer Analyst
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Roger Harman
Sent: Wednesday, November 25, 2015 1:39 PM
To: Midrange Systems Technical Discussion
Subject: SQL "like" from a subselect
I'm trying to match employee names (first or last) to text in the user profile. It's just a rough match to help operations in a task.
I have all the first & last names in a file and the user profile info in another.
I've tried "where lower(UPTEXT) like (select srchname from namefile)" but it fails with SQL0811 "Result of SELECT more than one row".
The search names are in the form of "%roger%". I can match singles in STRSQL.
I can whip up an RPG with %scan() but curious if I can make the subselect work. There are hundreds of profiles and thousands of employees.
Thanks in advance.
COMMON Certified Application Developer - ILE RPG on IBM i on Power OCEAN User Group
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l