Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to perform calculation with the previous record
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Need to perform calculation with the previous record
Miscellaneous
Thread ID:
00537434
Message ID:
00537434
Views:
33
Hi.

I have a table that contains historical data (price of stocks). I need to find which prices are invalid (50% variation for example).

Let say that I have these values:
CKC1 2001-07-03 28.0000
CKC1 2001-07-04 .0300
CKC1 2001-07-05 .0300
CKC1 2001-07-06 .0300
CKC1 2001-07-09 26.5000
CKC1 2001-07-10 25.5000
CKC1 2001-07-11 25.2500

I want to have a query result something like:
CKC1 2001-07-03 28.0000 2001-07-04 .0300
CKC1 2001-07-06 .0300 2001-07-09 26.5000

The calculation of the variation is:
ABS((Price1 / Price2) - 1) > .5

Have any ideas?
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Next
Reply
Map
View

Click here to load this message in the networking platform