I am trying to show oracle data in following format (need to produce in form of report- may be crystal report);
Table has following fields:
I am able to produce following results so far:
Query:
SELECT to_date('01/01/1999','dd/mm/yyyy') LOGDATE,
to_date('01/01/1999','dd/mm/yyyy') MONTH ,
''EMPCODE,
to_number('0') PROJECTCODE ,
''ACTIVITY,
to_number('0')TOTALTIME,
''ENTEREDBY,
''PROJECTDESC,
''SUB_SUBACT_SHORT_DESC,
B.*
FROM
(
select '1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'
from dual
UNION ALL
select to_char(TO_DATE(:MONTH,'DD/MM/YYYY'),'DY'),
to_char(TO_DATE(:MONTH ,'DD/MM/YYYY') + 1,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+2,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+3,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+4,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+5,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+6,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+7,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+8,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+9,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+10,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+11,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+12,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+13,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+14,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+15,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+16,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+17,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+18,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+19,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+20,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+21,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+22,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+23,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+24,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+25,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+26,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+27,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+28,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+29,'DY'),
to_char(TO_DATE(:MONTH,'DD/MM/YYYY')+30,'DY')
from dual
) B
UNION ALL
SELECT LOGDATE,TRUNC(LOGDATE,'MM') as period,
EMPCODE,
PROJECTCODE,ACTIVITYCODE || '.' || SUBACTIVITY_CODE || '.' || SUB_SUBACTIVITY_CODE AS ACTIVITY,
TOTALTIME ,ENTEREDBY,
PROJECTDESC,
SUB_SUBACT_SHORT_DESC,
CASE WHEN to_char(logdate,'dd') = '01' THEN to_char(TOTALTIME) END d1,
CASE WHEN to_char(logdate,'dd') = '02' THEN to_char(TOTALTIME) END d2,
CASE WHEN to_char(logdate,'dd') = '03' THEN to_char(TOTALTIME) END d3,
CASE WHEN to_char(logdate,'dd') = '04' THEN TO_CHAR(TOTALTIME) END d4,
CASE WHEN to_char(logdate,'dd') = '05' THEN TO_CHAR(TOTALTIME) END d5,
CASE WHEN to_char(logdate,'dd') = '06' THEN TO_CHAR(TOTALTIME) END d6,
CASE WHEN to_char(logdate,'dd') = '07' THEN TO_CHAR(TOTALTIME) END d7,
CASE WHEN to_char(logdate,'dd') = '08' THEN TO_CHAR(TOTALTIME) END d8,
CASE WHEN to_char(logdate,'dd') = '09' THEN TO_CHAR(TOTALTIME) END d9,
CASE WHEN to_char(logdate,'dd') = '10' THEN TO_CHAR(TOTALTIME) END d10,
CASE WHEN to_char(logdate,'dd') = '11' THEN TO_CHAR(TOTALTIME) END d11,
CASE WHEN to_char(logdate,'dd') = '12' THEN TO_CHAR(TOTALTIME) END d12,
CASE WHEN to_char(logdate,'dd') = '13' THEN TO_CHAR(TOTALTIME) END d13,
CASE WHEN to_char(logdate,'dd') = '14' THEN TO_CHAR(TOTALTIME) END d14,
CASE WHEN to_char(logdate,'dd') = '15' THEN TO_CHAR(TOTALTIME) END d15,
CASE WHEN to_char(logdate,'dd') = '16' THEN TO_CHAR(TOTALTIME) END d16,
CASE WHEN to_char(logdate,'dd') = '17' THEN TO_CHAR(TOTALTIME) END d17,
CASE WHEN to_char(logdate,'dd') = '18' THEN TO_CHAR(TOTALTIME) END d18,
CASE WHEN to_char(logdate,'dd') = '19' THEN TO_CHAR(TOTALTIME) END d19,
CASE WHEN to_char(logdate,'dd') = '20' THEN TO_CHAR(TOTALTIME) END d20,
CASE WHEN to_char(logdate,'dd') = '21' THEN TO_CHAR(TOTALTIME) END d21,
CASE WHEN to_char(logdate,'dd') = '22' THEN TO_CHAR(TOTALTIME) END d22,
CASE WHEN to_char(logdate,'dd') = '23' THEN TO_CHAR(TOTALTIME) END d23,
CASE WHEN to_char(logdate,'dd') = '24' THEN TO_CHAR(TOTALTIME) END d24,
CASE WHEN to_char(logdate,'dd') = '25' THEN TO_CHAR(TOTALTIME) END d25,
CASE WHEN to_char(logdate,'dd') = '26' THEN TO_CHAR(TOTALTIME) END d26,
CASE WHEN to_char(logdate,'dd') = '27' THEN TO_CHAR(TOTALTIME) END d27,
CASE WHEN to_char(logdate,'dd') = '28' THEN TO_CHAR(TOTALTIME) END d28,
CASE WHEN to_char(logdate,'dd') = '29' THEN TO_CHAR(TOTALTIME) END d29,
CASE WHEN to_char(logdate,'dd') = '30' THEN TO_CHAR(TOTALTIME) END d30,
CASE WHEN to_char(logdate,'dd') = '31' THEN TO_CHAR(TOTALTIME) END d31
FROM TIMESHEET
WHERE PROJECTCODE = 2274
AND LOGDATE >= TO_DATE('01/08/2011','dd/mm/yyyy')
AND LOGDATE <= TO_DATE('31/08/2011','dd/mm/yyyy')
AND TOTALTIME>0
>Is this possible to group the results by Activity? So 'pojectx' will be activity 1.11.1