<?php
select distinct (os.sam_startdate),((os.sam_enddate-os.sam_startdate)*24)*60
from sam_service os, sam_channel oc
where os.sam_status = 'C'
and to_char(os.sam_startdate, 'mm/yyyy') = '01/2009'
and oc.sam_channel= '7777'
order by os.sam_startdate
?>