Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Am not sure how to describe this but help!

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-18 : 00:52:01
Hervey writes "I have a table 'tblSingulars' which has 1322 rows

I wrote a query as follows

Step1:
select * into #tblOldSings
from tblSingulairs A,Delta_Singulair_Match B
where GDesiredPiece = B.vchIdentifier

GDesiredPiece and vchIdentifier are fields made up
of other fields (First Name, Last Name, Address) concatenated
to created a unique key

The number of rows resulting from this query is 993

Step2:
Then I take the complement of Step1 as follows:

select * into #tblNewSings
from tblSingulairs A
where A.GDesiredPiece not in (Select GDesiredPiece from tblSingulairsOK)

The number of items returned is 333

but 993 + 333 is not = 1322...

Yet, if I do a union of the table, I get 1322

can you guys please enlighten me...
I'd appreciate it...

I get 4 more rows that I cannot account for

Thanks a mil!"


- AND -

Hervey writes "I just submitted this question and realized I made a typo when typing the message...

in Step2

Step2:

where A.GDesiredPiece not in (Select GDesiredPiece from tblSingulairsOK)

should be

where A.GDesiredPiece not in (Select GDesiredPiece from #tblOldSings)

I just did not want someone to see that and think that's where I made the mistake....

Thanks in advance"
   

- Advertisement -