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
 General SQL Server Forums
 New to SQL Server Programming
 Using multiple fields as the unique identifier

Author  Topic 

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-06-10 : 15:12:28
Please see below post

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-06-10 : 15:36:01
I would like to make a change in this above question.

What I would really like to know is how to use 3 fields from a table called original, to find the corresponding lines that are not found in a tbl called posted using the 3 fields as the primary.

e.g Original
card_no ref_no tran_value
12 20 12.00
12 20 2.00
47 01 4.00
52 11 2.00
04 05 13.00
04 20 6.00



e.g Posted
card_no ref_no tran_value
12 20 12.00
12 21 2.00
47 01 4.00
52 25 25.00
04 20 6.00



e.g Result
card_no ref_no tran_value
12 20 2.00
52 11 2.00
04 05 13.00


I was thinking that the below query might work not sure thouh

select o.card_no
,o.ref_no
,o.tran_value

from OriginalErrorFiles o

where ref_no not in (select ref_no
from hopefullyworks
where card_no not in (select card_no
from hopefullyworks
where tran_value not in (select tran_value
from hopefullyworks)
)
)
Go to Top of Page

velvettiger
Posting Yak Master

115 Posts

Posted - 2008-06-10 : 16:57:51
Any ideas???????????
Go to Top of Page
   

- Advertisement -