• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

Select stament for finding deleted rows (Delta??)

I need to compare prodfeed1 table to prodfeed2 table and find rows that are in prodfeed1 table but not in prodfeed2 based on the number column. Not sure where to begin.

I am using SQL Server 2000
0
ubsmail
Asked:
ubsmail
1 Solution
 
Ephraim WangoyaCommented:

select * from prodfeed1
where numbercolumn not in (select numbercolumn from prodfeed2)
0
 
HainKurtSr. System AnalystCommented:
I prefere this

select a.*
from a left join b on a.id=b.id
where b.id is null
sample:

with a as(
select 1 id, 'HainKurt' UserName
union
select 2, 'HK'
),
b as(
select 1 id, 'HainKurt' UserName
union
select 3, 'EE'
)
select a.* 
  from a left join b on a.id=b.id
 where b.id is null

id	UserName
2	HK

Open in new window

0
 
Anthony PerkinsCommented:
HainKurt,
The author is using SQL Server 2000.  They can certainly use your solution, however the sample using CTE is going to fail for them.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Alpesh PatelAssistant ConsultantCommented:
select * from prodfeed1 where ID not in (select id from prodfeed2)
0
 
Kalyanum Deepak KumarCommented:
SELECT A.* FROM prodfeed1 A LEFT JOIN prodfeed2 B ON A.number  = B.number

- provided the column number is available in both the tables.
0
 
Anthony PerkinsCommented:
Would everyone please read previous solutions:

PatelAlpesh,
Yours is the same as http:#a35488708

DeepakKumarK,
Did you not see the solution here: http:#a35488780 ?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now