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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update query continued

Author  Topic 

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2003-03-26 : 09:22:16
I'd really appriciate if someone could take a look

http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=24818

I'd like to offer a book from Amazon.com for the person who finds a solution (provided it works in all cases)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-03-27 : 13:15:57
Hmmm, bribery. Such an incentive!

Tara
Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-03-27 : 23:35:07
Hmmm... If I understand right, you want to drill down to update all articleid's that appear in a particular prodid all the way down to the highest (or lowest, depending on what you're using) prodlevel.
Give me a bit of time. There's a weekend coming up.

OK, guys, I think we should all put our brains together to help Peter. The we will each get one page from the book.

Sarah Berger MCSD
Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-03-28 : 00:01:09
How's this:
update prodlog set amount = (select p.amount * prodlog.percentage from prodlog p where p.prodid = prodlog.prodid and p.input_output = 2)
where previd <> 0 and input_output = 1

Sarah Berger MCSD

Edited by - simondeutsch on 03/28/2003 00:02:22
Go to Top of Page

Peter Dutch
Posting Yak Master

127 Posts

Posted - 2003-03-28 : 02:30:56
Thanks Sarah for your input.

This updates the first 'step' correctly, DavidM posted a similar solution inside a loop which updates the whole table.

I do have my doubts if Amazon will sent out different pages of the
book to different addresses

Thanks again!

remains the question why on earth your nickname is 'simondeutsch'

Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-03-28 : 13:40:19
Deutsch is my maiden name, and I have been with SQLTeam since before my marriage (I think. Hey, I knew SQLTeam before I knew my husband!)
Simon is my dad's name, and I use the name simondeutsch for many "public" internet uses, such as member names, user names, email contacts, etc.
I try to hide the fact that I am one of the very few females with any brains...

Sarah Berger MCSD
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-29 : 09:49:35
And her dad gets all the junk mail, telemarketing calls, and, ummm...leather and plastic items.

Go to Top of Page
   

- Advertisement -