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



Thank you Santiago, both of those expressions worked fine and
got the same results.

So many ways to get the same result!

SQL is proving to be - interesting.

Thanks,
Lance



Santiago G Martí <smarti@xxxxxxxx> 4/1/2009 12:15 AM >>>
I think I arrive a bit late but, just for clarifying, try this:
SELECT a.*
FROM myFile a LEFT EXCEPTION JOIN
(SELECT b.* FROM myFile b
INNER JOIN myFile c USING(address)
WHERE c.account<>b.account) d USING(address)

or the same, in another way:
WITH notWanted AS
(SELECT b.*
FROM myFile b INNER JOIN
myFile c USING(address)
WHERE c.account<>b.account)
SELECT a.*
FROM myFile a LEFT EXCEPTION JOIN
notWanted d USING(address)








"Lance Gillespie"

<lgillespie@cvwd.

org>
Para
Enviado por: "'Midrange Systems Technical

midrange-l-bounce Discussion'"

s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>


cc


31/03/2009 23:32
Asunto
RE: SQL question



Por favor,

responda a

Midrange Systems

Technical

Discussion

<midrange-l@midra

nge.com>









YES!
Both work.

Now to understand why!

Thanks again,
Lance


"Elvis Budimlic" <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> 3/31/2009
1:25
PM >>>
Thinking about it a bit more, this might work as well:

select a.*
from myFile a exception join
myFile b join myFile c on b.address = c.address and b.account <>
c.account
on a.account = b.account and a.address = b.address

Join the mismatched values (b to c) then get the exceptions (a to b).

Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com


-----Original Message-----
Subject: RE: SQL question

Thank you, Elvis. When I ran your suggestion, I got:

KEY ACCOUNT ADDRESS
1 11 11 MAIN
3 11 11 MAIN
5 14 13 MAIN
7 16 15 MAIN
8 17 16 MAIN
9 16 15 MAIN
10 18 17 MAIN

which is very nearly what I want.
Unfortunately, it grabs key 7 and 9, which
it should not because key 6 (which is wrong in
my e-mail and should be account 15, address 15 Main)
gives a different account number for the same address.

Your code gives me a whole to tool, CTE's, so I am going
to look into that approach. It seems, as you say, a good
way to break down the problem.

Thanks again,
Lance



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


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

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.