× 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:59 AM, Ruthirapathi, Arulanandham X wrote:
Thanks, I guess this is equivalent to following condition.

(PARTTYPE = '1' AND PARTCOST > 999)
OR (PARTTYPE = '2' AND PARTCOST < 50)

Don Cavaiani on Wednesday, March 09, 2011 11:38 AM wrote:

[If] parttype EQ '1'
AND partcost GT 999
OR parttype EQ '2'
AND partcost LT 50


Yes.

I have requirement like below. How to put this condition in WRKQRY?

(PARTTYPE = '1' AND PARTCOST > 999)
OR (PARTTYPE = '2' AND (PARTCOST< 50 OR PARTQTY>1000))

Written as ORed generic conditions:

(cond_a)
OR (cond_b)

Then expanding cond_b into generic conditions:

cond_b ==> cond_c AND ( cond_d OR cond_e )

Though in WRKQRY, that must be written as:

cond_b ==> cond_c AND cond_d OR cond_c AND cond_e

effecting the logical equivalent:

( cond_c AND cond_d ) OR ( cond_c AND cond_e )

Expanding the original ORed conditions we have:

(cond_a)
OR ( ( cond_c AND cond_d )
OR ( cond_c AND cond_e ) )

Replacing generic conditions with their expressions:

( PARTTYPE = '1' AND PARTCOST > 999 )
OR ( ( PARTTYPE = '2' AND PARTCOST < 50 )
OR ( PARTTYPE = '2' AND PARTQTY > 1000 ) )

And removing all the parentheses for the query we have:

PARTTYPE = '1' AND PARTCOST > 999
OR PARTTYPE = '2' AND PARTCOST < 50
OR PARTTYPE = '2' AND PARTQTY > 1000

Regards, Chuck

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.