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



Bruce,
Thanks for the reply.
You assumption about the 3 file join is correct, and your statement is
pretty much what i'm doing.
maybe this makes some difference.  in your statement you used = on the
acctstat and sostat.  where the sql statement needs to be excluding those
values.

BAH, never mind.  it makes perfect sense why it doesn't work
i thought i could based on the 6 values in my orignal query  load those
possible combinations and get what i need.
but what i really want to do is exclude any records that have sostat of 'Y'
or 'C' and any records that have acctstat of 'AC' or 'PN' but have a sotype
of PEDLV or PDLV.

i guess another approach is in order here.

-----Original Message-----
From: R. Bruce Hoffman, Jr. [mailto:rbruceh@attglobal.net]
Sent: Friday, February 01, 2002 10:35 AM
To: midrange-l@midrange.com
Subject: Re: another can this be done with sql


----- Original Message -----
From: "Smith, Mike" <Mike_Smith@RGCResources.com>
To: <midrange-l@midrange.com>
Sent: Friday, February 01, 2002 10:16 AM
Subject: another can this be done with sql


> select * from SOFILE,ACCTFILE where soact = acctact  and sostat not in
('Y',
> 'C')  and acctstat not in ('AC', 'PN') and sotype in('PEDLV', 'PDLV')
> this works fine.
>
> but i've been tasked with trying to make it more flexible.  ie status
codes
> change etc.  So i created a file that has the possible combinations of
> Sostat, acctstat, and sotype(maybe i should have 3 files)  ie Y,AC,PEDLV
> Y,PN,PEDLV
> can i do this the way i've set this up, if so how?

Ok, I have to assume some things about your process:

>From your note, you said "possible combinations" so I have to assume that
you are completing a three file join now, not trying to implement the "not
in (" selections.

so, it should work with the following form:

select * from sofile s
join acctfile on soact = acctact  a
join codefile c on s.sostat = c.stat and a.acctstat = c.acctstat and
s.sotype = c.sotype

That last statement says "select records based on the codes all matching
some combination in the third file".

As for using three separate files in place of the third, the join would not
work the same. Three separate files would have the effect of "oring" the
join logic, not "anding" it.

===========================================================
R. Bruce Hoffman, Jr.
 -- IBM Certified Specialist - iSeries Administrator
 -- IBM Certified Specialist - RPG IV Developer

"Suppose you were an idiot...
  And suppose you were a member of Congress...
  But I repeat myself."
    - Mark Twain


_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.