Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to perform calculation with the previous record
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Need to perform calculation with the previous record
Divers
Thread ID:
00537434
Message ID:
00537434
Vues:
32
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform