This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Help in Query
It's not a secret anymore!