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-10-17 : 14:34:53
|
For some reason my statement below is not working. Am I missing something?Summing up ext_rebate in orderrebate file and updating the unit_price field with that amount in the oeordlin file. Only want to update records with a line_no = 9999 BEGINupdate oeordlin_sqlset unit_price = (select A.sumExt_rebatefrom(select Ord_no,sum(ext_rebate) as sumExt_Rebate from Orderrebategroup by ord_no)Awhere A.ord_no = oeordlin_sql.ord_no)from orderrebate join oeordlin_sql on orderrebate.ord_type = oeordlin_sql.ord_type andorderrebate.ord_no = oeordlin_sql.ord_no and orderrebate.cus_no = oeordlin_sql.cus_nowhere oeordlin_sql.line_no = 9999 and oeordlin_sql.item_desc_2 <>'CHANGE'END |
|
|
Vack
Aged Yak Warrior
530 Posts |
Posted - 2008-10-17 : 14:47:57
|
| After a little testing it works if I take out:and oeordlin_sql.item_desc_2 <> 'CHANGE'But I'm not sure why. that field is Char(30)What I'm trying to accomplish is if someone makes a change to a line they need to type CHANGE in description 2. If that exists I don't want that line updated. |
 |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-10-17 : 15:42:16
|
| ISNULL(oeordlin_sql.item_desc_2 ,'') <> 'CHANGE' |
 |
|
|
|
|
|