× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 3/9/11 9:04 AM, Ruthirapathi, Arulanandham X wrote:

I would like to create condition with logical operator OR in WRKQRY,
could you give me an example please?


Probably better to just use SQL instead, with all the free-form and parenthetical conditional logic of the WHERE clause versus the listed conditions in "OR groups" of the QRY feature; e.g. use STRQMQRY for a report from a SELECT statement. Or possibly using the SQL only to encapsulate the WHERE logic of the SELECT statement in a VIEW, if a *QRYDFN must be used for some reason.

Each OR conditional test in the "Record Selection" screen of Query/400 effects an implicit closed parenthesis for all prior conditions in the list and starts an implicit open parenthesis for the remaining conditions in the list.

Given the following list of conditions [although written
here left-to-right versus top-to-bottom] are in a Query:

Cond_A AND Cond_B OR Cond_C

that list of conditions effects the logical equivalent of:

( Cond_A AND Cond_B ) OR ( Cond_C )


However, in many cases the desired effect is instead:

Cond_A AND ( Cond_B OR Cond_C )

but per inability to specify precedence with parentheses,
the listed conditions must be written in the Query as:

Cond_A AND Cond_B OR Cond_A AND Cond_C

that list of conditions effects the logical equivalent of:

( Cond_A AND Cond_B ) OR ( Cond_A AND Cond_C )

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.