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
 problem

Author  Topic 

mana
Posting Yak Master

102 Posts

Posted - 2014-09-14 : 04:06:14
hello

i have the following code but it has no result
i have for each teil nummer in dbo.bewegungen several Von addresse in dbo.v_ME_Montage_Adressen but i want that just the first von address that will be found will be chosen for each teil nummer. can you help me please? am i right or shoud i write it in another way?
thank you

update dbo.Bewegungen_Inventur_Korrekturen
set Von_Addresse = F.Von_Adresse
FROM dbo.Bewegungen_Inventur_Korrekturen M
inner join (select top 1 Von_Adresse ,Teil_Nummer
from dbo.v_ME_Montage_Adressen order by Teil_Nummer ) F
ON
F.Teil_Nummer = M.Teil_Nummer;

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-09-14 : 07:46:28
What do you mean by doesn't work

1. Your query won't run at all or you get errors?
2. No records are updated?
3. Records are you updates incorrectly? If so, what would be correct?

Looking at your query, you might want order by address
Go to Top of Page
   

- Advertisement -