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 |
|
chrispy
Posting Yak Master
107 Posts |
Posted - 2003-03-26 : 21:02:29
|
| Not sure why but I am having a hard time with this one.I have two tables.Products_tempname nvarchar 50List_Price int 4Products_ename nvarchar 50List_Price int 4Both tables have the name of the product in them. Products_temp has the list price while Products e does not.How would I write an update statement to get them over??Thanks in advance,Chris |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
|
|
chrispy
Posting Yak Master
107 Posts |
Posted - 2003-03-26 : 21:39:18
|
| Merkin, Link doed not work but I was able to find the article. Excellent article.Problem is that I was not correct in assuming what I needed.Here is what I have (correct this time)Products_temp name nvarchar 50 List_Price int 4 Products_e productid int 4 List_Price int 4ProductsUID int 4name nvarchar 50 Now let me try to explain again :)Products_e and Products are related by the UID and productIDProducts has the name and Products_temp has the name and the list price. I am trying to get the list price update into the Products_e.Makes it even more difficult. (for me at least).Thanks again,chris |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-03-26 : 21:47:50
|
HiSame technique as that article, just needed a little expanding to fit your tables.--Assuming that UID is productid, I'd change that...it's dumb UPDATE Products_eSet List_Price = Products_temp.List_PriceFROMProducts_eINNER JOIN Products ON Products.uid = Products_e.ProductidINNER JOIN Products_Temp ON Products_Temp.name = Products.Name Does that work for you ?Damian |
 |
|
|
chrispy
Posting Yak Master
107 Posts |
Posted - 2003-03-26 : 21:52:47
|
| Ok I feel like a foolI tried but was not getting it to work. Your tsql worked perfectly.Thanks so much.Chris |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-03-26 : 21:54:28
|
quote: Your tsql worked perfectly.
Hey, there is a first for everything !!!! Damian |
 |
|
|
|
|
|