Join on a "like"? Haven't seen that before. Maybe later this week when I have some free time (Ha!). Month-end today.......
Thanks.
________________________________________
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxx> on behalf of Mark Murphy/STAR BASE Consulting Inc. <mmurphy@xxxxxxxxxxxxxxx>
Sent: Monday, November 30, 2015 8:06 AM
To: Midrange Systems Technical Discussion
Subject: Re: SQL "like" from a subselect
have you tried:
where exists (select * from namefile where lower(UPTEXT) like srchname)
This, like your below listed attempt, will not show you what comes up in the subselect, but will tell you which of your rows have a match.
Or if you want to see the matching records you can try something like:
select * from profiles
join namefile on lower(UPTEXT) like srchname
profiles is a guess at the name of the file holding your profiles.
Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx
-----Roger Harman <roger.harman@xxxxxxxxxxx> wrote: -----
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: Roger Harman <roger.harman@xxxxxxxxxxx>
Date: 11/25/2015 02:39PM
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.
Roger Harman
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,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
--
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,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.