cruser3
03-29-2006, 03:16 PM
Is this possible through SQL:
We have a table with a date column and another which is populated with a flag(rule) from another table which has a bunch of rules.
So the data is like this:
TDATE RULES
----------- ------
1-Oct-2004 1884.1886
2-Nov-2005 1921.
4-Jan-2006 1884.
7-Nov-2006
Each of the values (1884,1921) is a rule in another table and is concatenated with a dot (.) and inserted into the above table.
First we wanted the count of rules by month so this worked:
select to_char(DATE,'Mon YYYY'), count(RULES)
from DETAIL
where RULES IS NOT NULL
group by rollup(to_char(DATE,'Mon YYYY'))
order by to_date(to_char(DATE,'Mon YYYY'),'Mon YYYY')
Now we need a count of individual rules by month - each 4 digit number above is a rule.
Is this possible through SQL ?
Rgds.,
We have a table with a date column and another which is populated with a flag(rule) from another table which has a bunch of rules.
So the data is like this:
TDATE RULES
----------- ------
1-Oct-2004 1884.1886
2-Nov-2005 1921.
4-Jan-2006 1884.
7-Nov-2006
Each of the values (1884,1921) is a rule in another table and is concatenated with a dot (.) and inserted into the above table.
First we wanted the count of rules by month so this worked:
select to_char(DATE,'Mon YYYY'), count(RULES)
from DETAIL
where RULES IS NOT NULL
group by rollup(to_char(DATE,'Mon YYYY'))
order by to_date(to_char(DATE,'Mon YYYY'),'Mon YYYY')
Now we need a count of individual rules by month - each 4 digit number above is a rule.
Is this possible through SQL ?
Rgds.,