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 |
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2008-09-09 : 14:55:25
|
Have the following script that keeps subtracting from my amount each time I run the script when I only want to run it once. bdr_hfl is my amount. I'm going to add a Posted flag to freefield4 which I think is going to solve my problem. So would I just add another clause in my where statement below?where freefield4 = 'N'beginUPDATE eSET e.bdr_hfl = e.bdr_hfl - d.xFROM gbkmut AS eINNER JOIN ( SELECT faktuurnr, SUM(bdr_hfl) AS x FROM gbkmut WHERE freefield3 = 'Rebate' GROUP BY faktuurnr ) AS d ON d.faktuurnr = e.faktuurnrWHERE e.reknr = ' 12001'end |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-09-09 : 16:32:14
|
| Not sure what your question is. >>Have the following script that keeps subtracting from my amount each time I run the script when I only want to run it once. If you only want to run it once than why do you keep running it?Be One with the OptimizerTG |
 |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-09-10 : 01:49:24
|
| Is you issue that this code is part of a larger workflow.? If that is the case , set up a separate query that checks for your conditions , and then decide if you are to run the code.Jack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
|
|
|