× 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 22 Sep 2013 16:33, Hoteltravelfundotcom wrote:
I have a VIEW with these WHERE Conditions. I would like to add
another type on the 3rd line. Here I want also those rows with like
as "FR" is there a way to sort of have such a group like that under
the LIKE clause?

WHERE ASTDTA.ICPRTMIA.IARCC9='ACS'
AND ASTDTA.OEINDLID.IDCOM#='001'
AND ASTDTA.OEINDLID.IDPRT# LIKE 'ACS%'
AND ASTDTA.ADRESSAD.ADSFX# = SUBSTR(ASTDTA.OEINDLID.IDGRC#,9,3)

I am unsure if I interpreted what was attempted to be expressed as the desired effect, but I offer [given my interpretation]:

WHERE ASTDTA.ICPRTMIA.IARCC9='ACS'
AND ASTDTA.OEINDLID.IDCOM#='001'
AND ( ASTDTA.OEINDLID.IDPRT# LIKE 'ACS%'
OR ASTDTA.OEINDLID.IDPRT# LIKE 'FR%'
)
AND ASTDTA.ADRESSAD.ADSFX#=SUBSTR(ASTDTA.OEINDLID.IDGRC#, 9, 3)

P.S. The use of correlation identifiers protects against excessive changes that would be required given any change in a schema or table name were required; that also IMO makes the SQL much more readable. Also note that a space was added after each comma in the SUBSTR scalar to make the expression functional globally. FWiW the above WHERE-clause rewritten using some correlation names makes the predicates fit on a line with fewer characters and would allow the entire WHERE-clause to remain unchanged when the table or library name for the table-reference had changed, given the correlation-name was left unchanged:

WHERE ICP.IARCC9='ACS'
AND OEI.IDCOM#='001'
AND ( OEI.IDPRT# LIKE 'ACS%'
OR OEI.IDPRT# LIKE 'FR%'
)
AND ADR.ADSFX#=SUBSTR(OEI.IDGRC#, 9, 3)


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.