× 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 11-Sep-2014 12:08 -0500, RPGLIST wrote:
I have a file with over 18,000 stop off points, They are grouped
according to the pro number and stop off number:

Pro: 198756
Stop: 1

Pro: 198756
Stop: 2

etc.

Within each set I have a field that is used for billing purposes:
BillPnt

Now, all the lines should have the exact same bill point value, it
is a 3 alpha field, it can be blank as well.

I need to select all the records where the <ed: bill point> value
is different from one stop off point to another grouped by the pro
number.

IE:

_BAD_
Pro: 198756
Stop: 1
BillPnt: 707

Pro: 198756
Stop: 2
BillPnt: *Blank

_GOOD_
Pro: 205478
Stop: 1
BillPnt: 200

Pro: 205478
Stop: 2
BillPnt: 200


I need to capture in a new file just the Pro number for those that
have a mismatch IE: BAD.

I can group the records, but I'm not sure how to structure the SQL
statement for the comparison....

Suggestions would be greatly appreciated.


FWiW: The topic seems unrelated to RPG.

Seems the following script may establish a setup that reflects the above givens:

create table SOPs
( Pro integer, Stop dec, BillPnt char(3) not null )
;
insert into SOPs values
( 198756, 1, 707 ), ( 198756, 2, '' )
, ( 205478, 1, 200 ), ( 205478, 2, 200 )
;

As I understand: As a rule, irrespective of /Stop/ for any /Pro/, there must be only one Bill Point value across each unique value of /Pro/. And the data in a new file would identify every /Pro/ for which there is an exception to that rule? If so, then perhaps the following [almost identical to what Scott offered, but omitting the aggregate COUNT data from the result-set]:

create table SOPsBAD as
( select Pro
from SOPs
group by Pro
having count(distinct BillPnt) > 1
) with data


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.