No Dennis
these were 2 separate sql selects to see if either file had non-unique
LOCN's
Alan Shore
Programmer/Analyst, Direct Response
E:AShore@xxxxxxxx
P:(631) 200-5019
C:(631) 880-8640
"If you're going through Hell, keep going" - Winston Churchill
"Dennis Lovelady"
<iseries@lovelady
.com> To
Sent by: "'Midrange Systems Technical
midrange-l-bounce Discussion'"
s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx>
cc
<midrange-l-bounces@xxxxxxxxxxxx>
12/09/2009 01:27 Subject
PM RE: Help with a fairly basic SQL (I
think)
Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>
I have only had that message when the field (LOCN in this case) is NOT
unique Try the following SQL select LOCN, count(*) from tomh/locnmstrpf
group by LOCN having count(*) >
2
and
select LOCN, count(*) from adp/locnmstrpf group by LOCN having count(*)
2
if you get a display in either one then LOCN is NOT unique
Your subquery is this:
select a.printer from tomh/locnmstrpf a, adp/locnmstrpf b where
a.locn=b.locn and a.printer<>' ' and b.printer=' '
If you run that, you will find that it returns all rows except those where
the printer is not blank or there's no match on locn. Your "Where exists"
clause may as well say "WHERE 1 < 2" for all the good it does.
Simplify.
Update mytable a
Set myfield = (select b.myfield
from backuptable b
where a.keydata = b.keydata
)
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"God bless the Holy Trinity"
-- placard in a Dublin parade
--
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.