wood burning stoves 2.0*
The moose likes Oracle/OAS and the fly likes how to display all months of a particular year according to the following rule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "how to display all months of a particular year according to the following rule" Watch "how to display all months of a particular year according to the following rule" New topic
Author

how to display all months of a particular year according to the following rule

rama subba reddy
Greenhorn

Joined: Nov 07, 2005
Posts: 2
I have the following data and i have three buttons(yearly,monthly and weekly)



The table(tab1) having two columns(col1 date values and col2 number values) .





Col1 col2

---------------------- ------------------------------

12-mar-04 10

23-may-05 6

10-apr-04 9

15-mar-04 5

20-mar-04 5







THIS IS FOR YEARLY QUERY:



whenever user select the particular date (ex:10-mar-04) and click the year button, the output like the following :

the user selected that particular date ,if that date having data then we have to display that data, otherwise we have to display zero only.
if more than one time exists that date then we have to display that sum of data.so everytime we have to display 12 rows for this year button.







Date sum

------------------ ----------------------------

jan 04 0

feb 04 0

mar 04 20(=10+5+5)

apr 04 9

may 04 0

jun 04 0

jul 04 0

-- --

-- --

-- --

dec 04 0













THIS IS FOR MONTHLY QUERY:



For aboue date(10-mar-04):

Whenever user click the month button ,the output like the following :
here we have to display weekly wise data(ie how much data is there entire week) for this monthly button.first we have to display first date of that month and next we have to display next sunday date and then next we have to display next sunday, etc


Date Sum

-------------------- -----------------------------------

01-mar-04 0

07-mar-04 10

14-mar-04 10(5+5)

21-mar-04 0

28-mar-04 0











THIS IS FOR WEEKLY:



for aboue date(10-mar-04):

whenever user click weekly button,the output like the following:
here we have to display the particular week days only,that means
only sunday to saturday(if exists that dates), otherewise how many week days are exists of that date that dates only we have to display.
so for this button we will display minimum 1 row and maximum 7 rows.


Date Sum

---------------------- -----------------------------

07-mar-04 0

08-mar-04 0

09-mar-04 0

10-mar-04 0

11-mar-04 0

12-mar-04 10

13-mar-04 0







if any one got this queries then immediately send me.
[ November 07, 2005: Message edited by: rama subba reddy ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Rama,
Welcome to JavaRanch!

I don't fully understand what you are trying to do. Where do the zeros come from?


[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
kishore chitturi
Ranch Hand

Joined: Nov 28, 2004
Posts: 50
Hi Jeanne Boyarsky,
if there is no data in a particular month, the corresponding row should show a "0" value.


Thanks & Regards
Kishore.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

I see. You could do it with a combination of an in clause an an outer join. The in clause lists what you want to display (months, weeks, etc). The outer join shows the row even if the count is zero.

You need some mechanism to build up the logic for the in clause. You could use JDBC or PL/SQL to do that. Either has loops.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to display all months of a particular year according to the following rule
 
Similar Threads
Help me to have a sortable table in my html profile!
JDBC
A little SQL help with SUM()
getting java.sql.Timestamp exception
xml calendar