File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

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

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 is still alive.

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

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I agree. Here's the link:
subject: Help in Query
It's not a secret anymore!