Results 1 to 1 of 1
Thread: Help in Query
- 03-31-2008, 01:16 PM #1
Member
- Join Date
- Mar 2008
- Posts
- 13
- Rep Power
- 0
Help in Query
Hi
I need some suggestions from you experienced programmers
I have the table with the fileds Sno,Close,Avg
after 10 th row i have to find avg of all closes form 1 to 10 and display as avg colum
in 12 th row i have to discard the colum value of close 1 and find the avg of close from 2 to 11
13 th row i have to discard the colum value of close 2 and find the avg of close from 3 to 12
when i am inserting the new row in the table ,i have to find the avg of 10 closes from this close value
like so on --------------------------------
fro eg
Sno close avg
1 11 null
.
;
,
.
10 123 null
11 231 avg(close(1 to 10)
12 211 avg(close(2 to 11)
13 123 avg(close(3 to 12)
i tried with one query
SELECT AVG(CLOSE1) FROM STACK WHERE SNO >(SELECT MAX(SNO)-1 FROM STACK)
but its giving the results from 1 to 11
how can i change my code
if any one hava idea please tell me
Similar Threads
-
HELP: SQL Query Validator
By rjuyal in forum JDBCReplies: 1Last Post: 05-05-2008, 08:13 AM -
Help In An Critical Query
By raj reddy in forum JDBCReplies: 1Last Post: 04-22-2008, 02:24 AM -
Hibernate sql query
By taicode in forum JDBCReplies: 0Last Post: 03-25-2008, 04:17 PM -
Using sql:query tag
By Java Tip in forum Java TipReplies: 0Last Post: 01-15-2008, 03:13 PM -
Using sql:query tag
By Java Tip in forum Java TipReplies: 0Last Post: 01-14-2008, 09:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks