Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent Help in Query

 
Geeta Ravikanti
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
 
Scott Selikoff
author
Saloon Keeper
Posts: 4015
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kevin Smither
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34671
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic