× 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.



I didn't get that the DetailFile was the same file. Alan Shore's solution
may be the better one.





From: Darren Strong <darren@xxxxxxxxx>
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Date: 03/23/2016 01:23 PM
Subject: Re: SQL Select This and/or That
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



Try a "left outer join"

select a.field1, b.rdItmVlu, c.rdItmVlu
from HeaderFile A
left outer join DetailFile B
on a.Key1 = B.Key1
AND b.RcdType = 'ABC'
AND b.rdItmVlu <> ' '

left outer join DetailFile C
on a.Key1 = c.Key1
AND c.RcdType = 'XYZ'
AND c.rdItmVlu <> ' '





From: Jack Prucha <Jack.Prucha@xxxxxxx>
To: "midrange-l@xxxxxxxxxxxx" <midrange-l@xxxxxxxxxxxx>
Date: 03/23/2016 01:15 PM
Subject: SQL Select This and/or That
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



I'm having a hard time visualizing how to do this. There's a "Header" and
"Detail" file where I want to return information from both whenever at
least one of these situations occur. What I've coded only returns if both
situations occur. This gets me most of what I want:

select a.field1, b.rdItmVlu, c.rdItmVlu from HeaderFile A, DetailFile B,
DetailFile C

WHERE a.Key1 = B.Key1
AND b.RcdType = 'ABC'
AND b.rdItmVlu <> ' '

AND a.Key1 = c.Key1
AND c.RcdType = 'XYZ'
AND c.rdItmVlu <> ' '

Selection should occur if either the ABC or XYZ record has the, well,
undesired values rather than my example which selects only if both records
meet the selection criteria. I know I can use the Coalesce to default the
rditmvlu for which ever record isn't there. But how can I "subselect" and
return the value back to the original select? Can't assume each record
type exists.

7.1 with all the TRs installed

Thanks in advance!

Jack Prucha
Programming Team Supervisor
College Foundation, Inc.
919.835.2530

This email, including any documents, files, or previous email messages
attached to it, has been sent from an email account of College Foundation
Inc., (CFI) and may contain confidential, proprietary, or legally
privileged information belonging to CFI. If you are not the intended
recipient, any dissemination, distribution, or copying of this email or its
attachments is strictly prohibited. If you have received this email in
error, please immediately notify the sender by email and destroy the
original email and any attachments.
--
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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.



--
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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.