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.
Author |
Topic |
thanksfor help
Posting Yak Master
106 Posts |
Posted - 2007-09-26 : 16:07:55
|
Hi,When I run a same join in select and update, I get different number of record count.Here is the example, It updates only 1070 records.Update aset a.materialcost = b.costFROM tbl_A ainner join tbl_B b on a.itemnumber = b.itemnumber where b.cost <> 0On Select, it returns 1085 recordsSelect a.materialcost , b.costFROM tbl_A ainner join tbl_B b on a.itemnumber = b.itemnumber where b.cost <> 0Is this possible or I am missing something here.thanks in advance. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-26 : 16:10:49
|
It means you have duplicates itemnumber in the tbl_B table.try thisSelect distincta.materialcost , b.costFROM tbl_A ainner join tbl_B b on a.itemnumber = b.itemnumber where b.cost <> 0 E 12°55'05.25"N 56°04'39.16" |
 |
|
thanksfor help
Posting Yak Master
106 Posts |
Posted - 2007-09-26 : 16:19:50
|
Thank you so much. Distinct cleared the confusion. |
 |
|
|
|
|