|
Obviously, I can't test this but give it a try.
With Temp_Sub as Select Sub_Acct, Address from Table
Temp_Account as Select Account, Address from Table
Select Temp_Sub.Sub_Acct, Temp_Account.Account
>From Temp_Sub
Join Temp_Account on Temp_Account.Address = Temp_Sub.Address And
Temp_Account.Account <> Temp_Sub.Sub_Acct
I'm not sure how this will work without a "play-around" but it looks right.
There are probably others out the error of my ways.
Gord
-----Original Message-----
From: Mark Allen [mailto:mallen@xxxxxxxx]
Sent: Friday, September 12, 2003 10:02 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL Newbie ?
Is there a way to do this in SQL?
File as such
Sub Acct Account Address
ABCD ABCD XYZ
EFGH EFGH XYZ
IJKL IJKL ABC
MNOP IJKL ABC
QRST QRST XYZ
I want to list those who have matching addresses but the account is not
the same
So from above I want to see:
First Possible Match
ABCD EFGH
ABCD QRST
I've kinda got it working in query but it gives me
ABCD EFGH
ABCD QRST
EFGH ABCD
EFGH QRST
QRST ABCD
QRST EFGH
which makes the list huge
I know I can do it in RPG but looking for a SQL solution if possible
Mark Allen
IS Manager
Wilkes Telephone & Electric
11 W. Court Street
Washington, GA 30673
Phone: (706) 678-9565
Fax: (706) 678-1000
_______________________________________________
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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.