HI
I am running SQL query in sql plus using script.
THE query is get count for jan 1st,2,3,4,5 from table.
I need output for each day for 5 days.
my query
is

SPOOL /test/emprpt.csv

but, i need the output horizantal way look to format like this in excel.
that is why using csv file to automatically format in excel
.how can i get this?
thanks.N.
I get the output like this in excel.

select 'jan1st' from dual;
select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');
select 'jan2nd' from dual;
select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');
and so on... for all 5 queries.

output will be like this in excel.
JAN1ST: 800
JAN 2ND: 588
JAN 3RD: 478
JAN 4TH:123
JAN 5TH: 789.
but, i want output like this way in excel in horizontal way.


JAN 1ST JAN 2ND JAN 3RD JAN 4TH JAN 5TH
800 588 478 123 789

SPOOL /test/emprpt.csv
select 'jJAN 1ST, JAN 2ND, JAN3RD, JAN 4TH, JAN 5TH' FROM DUAL;
select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');

select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');

select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');

select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');

select count(empstatus)
from emp,dept
where emp_id = dept_id
and emptype = 'finance'
and emp_TimeStamp1 >= TO_DATE('&startday 00:00:01','YYYY-MM-DD HH24:MI:SS')
and emp_TimeStamp2 <= TO_DATE('&enddate 23:59:00','YYYY-MM-DD HH24:MI:SS');
SPOOL OFF
EndOfCat
But how can i get sql query result in horizontal way.

i run above query with change the variables for start date and end date in the script for jan1st,2,3,4,5.

i looked pivot. i did not understand. how to write this to get the result
in horizontal way.

pl help.
thx,N.