This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes Help in Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

Help in Query

Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
I have the table like following

Time/Date Close Average

1 100 NO
2 200 No
3 129.39 No
4 200 No
5 129.39 No
6 100 NO
7 200 No
8 129.39 No
9 100 NO
10 200 No
11 123 avg(close(1 to 10)/10)
12 234 avg(close(2 to 11)/10)has to display
13 231 avg(close(3 to 12)/10)has to display
14 . ...
15 . ...and so on
16
17
18
19
29

where ever i want to find the avg ,I have to take the 10 closes values beofore the curent value
how can i write that query in Sql
I dont know the logic in writing the query in Sql

please help me
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

your original thread http://www.coderanch.com/t/306702/JDBC/java/Help-Query is still alive.

please don't post the same question multiple times, as it wastes people's time when multiple redundant conversations take place.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
Consider Paul's rocket mass heater.
 
subject: Help in Query