Results 1 to 1 of 1
12-27-12, 13:39 #1Registered User
- Join Date
- Dec 2012
Unanswered: RowCount in cascaded Select queries
i just cant find a way to get this query to work.
what i want is basically a result graph extracted from a database, and i want this graph to be reduce to 500 row (the un-reduced tables have several 10k of rows)
select totalProfit from ( SELECT sum(hp.totalProfit) over (order by h.startTime) as totalProfit, row_number() over () as rn, FROM hp INNER JOIN h ON (h.id = hp.handId) WHERE hp.playerid in (11) ORDER BY h.startTime ) where (rn % DIVISOR)<=1;
i tested it manually (calculating the DIVISOR value by hand for each pl.id) and the result i get is always something between 495-500 rows, which is fine.
i would like to avoid using statistical functions as its not necessary. but havent found any way to get number of rows from the inner SELECT into the where of the outer select.
your help is much appreciated