Just in case it hasn't been considered, you can keep it down to one row with the clause FETCH FIRST 1 ROWS ONLY.


-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Vernon Hamberg
Sent: Wednesday, November 25, 2015 2:56 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL "like" from a subselect

Hi Roger

LIKE needs to compare against a single value - not multiple rows.

You might try WHERE lower(UPTEXT) in (select...)

but that doesn't allow for wildcards

Not sure where to go next with this - it's virtual "Friday" here - holiday tomorrow, right?

Cheers
Vern

On 11/25/2015 1:38 PM, Roger Harman wrote:
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.


--------------------------------------------------------------------------------
Confidentiality Notice: This email may contain confidential information or information covered under the Privacy Act, 5 USC 552(a), and/or the Health Insurance Portability and Accountability Act (PL 104-191) and its various implementing regulations and must be protected in accordance with those provisions. It contains information that is legally privileged, confidential or otherwise protected from use or disclosure. This e-mail message, including any attachments, is for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. You, the recipient, are obligated to maintain it in a safe, secure and confidential manner. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Thank you.
--------------------------------------------------------------------------------


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].