File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Urgent Help in Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Urgent Help in Query" Watch "Urgent Help in Query" New topic
Author

Urgent 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 beofre the curent value
how can i write that query

please help me wrinting this query in java
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Why is this urgent?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

I think this may be one of the first times I've seen "...and so on" and had no idea what the person was talking about.


My Blog: Down Home Country Coding with Scott Selikoff
Kevin Smither
Ranch Hand

Joined: Oct 22, 2007
Posts: 30
you want to write the query in Java? What do you mean by that? I am assuming this is a database query?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30749
    
156

Geeta,
First of all, you want to write the query in SQL. Java JDBC just lets you call SQL. The query is still written in SQL.

I don't follow what you are trying to do either. Can you describe the desired output a bit more.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Urgent Help in Query