TSQL - Need count of 'Higher highs'
Here is a 2 column table called HIGHVALS. I am looking for TSQL to count
the number of higher highs in column B. Row 1 starts the counting at 1. At
row 2 the count is 2 because 1525.34 is > than 1520.08. Rows 3 and 4 do
not contribute to the count because they are both < 1525.34 the last
highest value. Row 5 contributes to the count because 1543.47 is > 1525.34
the last highest value. The end result of the counting should be 14.
A, B
1, 1520.08
2, 1525.34
3, 1519.99
4, 1525.27
5, 1543.47
6, 1545.25
7, 1545.78
8, 1552.48
9, 1556.27
10, 1556.77
11, 1556.39
12, 1563.32
13, 1563.62
14, 1560.7
15, 1557.25
16, 1561.56
17, 1558.71
18, 1557.74
19, 1564.91
20, 1563.95
21, 1564.07
22, 1570.28
23, 1570.57
24, 1573.66
No comments:
Post a Comment