we're running a query that returns duplicate records when it
_absolutely_ should not, that is, the data should have only unique
records. i remember reading some similar scenario that was either
service pack or dop related. this is only happening on one of our
boxes. this ring a bell w/ anyone? thanks,
arthurDuplicate records ring the bell of "using outer joins where not expected"
Kind of fuzzy for us to help you without any DDL / DML or sample data.
Jens Smeyer.
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113512308.829100.162530@.g14g2000cwa.googlegroups.com...
> we're running a query that returns duplicate records when it
> _absolutely_ should not, that is, the data should have only unique
> records. i remember reading some similar scenario that was either
> service pack or dop related. this is only happening on one of our
> boxes. this ring a bell w/ anyone? thanks,
> arthur
>|||let me assure you, there are no outer joins. basically the query is:
select a.f2, b.f2
from a inner join b on a.f1 = b.f1
where a.f3 = y
if i run either
select * from a where f1 = x or select * from b where f2 = x
i only get one record. however when i join the two in the first query,
i get four records.|||But that are different queries.
Image the sample data
Table 1
=====
f1 f2 f3
x x y
a u y
b u y
c u y
d u y
select * from a where f1 = x --> 1
Table 2
======
f1 f2 f3
u x y
a a y
b b y
c u y
d u y
select * from b where f2 = y --> 1
> select a.f2, b.f2
> from a inner join b on a.f1 = b.f1
> where a.f3 = y
--> 4
Try checking your join !
HTH, Jens Smeyer
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113516845.847086.23020@.g14g2000cwa.googlegroups.com...
> let me assure you, there are no outer joins. basically the query is:
> select a.f2, b.f2
> from a inner join b on a.f1 = b.f1
> where a.f3 = y
> if i run either
> select * from a where f1 = x or select * from b where f2 = x
> i only get one record. however when i join the two in the first query,
> i get four records.
>|||sorry, i should have left off the where a.f3 = y (or changed it to
where a.f1 = x) . my real query has a similar condition in it but does
not contribute to the duplicate records.
in any case, we're getting sidetracked. i am 100% sure there is nothing
wrong with the query - we have 2 boxes with the exact same data and one
returns duplicate data, the other doesn't.
like i said, i remember something about a bad service pack or dop
setting that causes this to happen.
arthur|||If you are concerned about processor settings try this:
Try adding
<SelectQuery>
OPTION (MAXDOP 1)
or look here if it doesnt work
http://support.microsoft.com/kb/266372/EN-US/
HTH, Jens Smeyer
http://www.sqlserver2005.de
--
"arthur" <alangham@.gmail.com> schrieb im Newsbeitrag
news:1113593450.443922.169900@.l41g2000cwc.googlegroups.com...
> sorry, i should have left off the where a.f3 = y (or changed it to
> where a.f1 = x) . my real query has a similar condition in it but does
> not contribute to the duplicate records.
> in any case, we're getting sidetracked. i am 100% sure there is nothing
> wrong with the query - we have 2 boxes with the exact same data and one
> returns duplicate data, the other doesn't.
> like i said, i remember something about a bad service pack or dop
> setting that causes this to happen.
> arthur
>|||thanks! that got rid of the duplicate records. very odd since this is
not a complex query at all. do you know if this issue is related to any
service pack/hot fix?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment