Win a copy of Functional Reactive Programming this week in the Other Languages forum!

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

rama subba reddy
Greenhorn
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
author & internet detective
Marshal
Posts: 34973
379
Rama,
Welcome to JavaRanch!

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

kishore chitturi
Ranch Hand
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
author & internet detective
Marshal
Posts: 34973
379
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.