Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 15 of 15 total
Thread SQL UPDATE that will update a field based on other fields in same record
Tue, Jul 23 2013 9:43 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Is that just down to network traffic or something else? >>

Yep, just network traffic and turnaround time on each request.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jul 24 2013 10:02 AMPermanent Link

John Hay

If there is only 1 record per date then using Fernando's query.  If there are multiple records per date add a unique field to the select list/group by and use that (unique key) as the join for the update.

SELECT
   MyDate, MyAmountPositive, MyAmountNegative, RUNSUM(coalesce(MyAmountPositive,0) - coalesce(MyAmountNegative,0)) AS MyTotal into memory\temp from mytable
 GROUP BY
   MyDate;
update mytable set mytotal=temp.mytotal from mytable join memory\temp on mytable.mydate=temp.mydate;
drop table memory\temp

John
Wed, Jul 24 2013 11:33 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


I knew you could do it - how's life in Edinburgh?

Roy Lambert
Thu, Jul 25 2013 5:09 AMPermanent Link

John Hay

Hi Roy,

Been very busy with work and lots of golf!  Scotland is such a wonderful place when we get a bit of sun (must be especially gorgeous where you are).

Hope life is treating you well.

John
Thu, Jul 25 2013 10:42 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

John


>Been very busy with work and lots of golf! Scotland is such a wonderful place when we get a bit of sun (must be especially gorgeous where you are).

Nah! To dammed hot. I didn't move up here to sweat all day Smiley

>Hope life is treating you well.

Life is - the economy still isn't but we're being told all the time its improving so there's still hope.

Roy
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image