For Programmers: Free Programming Magazines  


Home > Archive > SQL Server Programming > February 2005 > Update current row(s) from previous row









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Update current row(s) from previous row
Kurt Schroeder

2005-02-28, 9:01 pm

I need to update a current row(s) from a previous row(s)

the keys are CSIID and CSIDATE

If i want to update all rows for today from the values from yesterday i
would need to match the csiid = csiid and check for the dates
Would it be

Update [todays rows] where [todays rows].date = today
from [yesterdays rows] where selected [yesterdays row].[date] = yesterday

i'm not sure how to write the update/select for this. Anyhelp would be
appreciated.
thank you

Adam Machanic

2005-02-28, 9:01 pm

Can you post DDL/sample data/sample output?

http://www.aspfaq.com/etiquette.asp?id=5006

--
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--


"Kurt Schroeder" <KurtSchroeder@discussions.microsoft.com> wrote in message
news:3CB5893B-7EAC-45B3-8042-B18414760F4F@microsoft.com...
> I need to update a current row(s) from a previous row(s)
>
> the keys are CSIID and CSIDATE
>
> If i want to update all rows for today from the values from yesterday i
> would need to match the csiid = csiid and check for the dates
> Would it be
>
> Update [todays rows] where [todays rows].date = today
> from [yesterdays rows] where selected [yesterdays row].[date] = yesterday
>
> i'm not sure how to write the update/select for this. Anyhelp would be
> appreciated.
> thank you
>



Kurt Schroeder

2005-02-28, 9:01 pm

thanks for responding. I have to select each row in the application so i will
be doing it in the app.
thanks

"Adam Machanic" wrote:

> Can you post DDL/sample data/sample output?
>
> http://www.aspfaq.com/etiquette.asp?id=5006
>
> --
> Adam Machanic
> SQL Server MVP
> http://www.sqljunkies.com/weblog/amachanic
> --
>
>
> "Kurt Schroeder" <KurtSchroeder@discussions.microsoft.com> wrote in message
> news:3CB5893B-7EAC-45B3-8042-B18414760F4F@microsoft.com...
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com