Select date, optional field 1, 2,sum (Type 1) type 1,sum (Type 2) type 2,sum (Type 3) type 3,sum (Type 4) type 4,sum (Type 5) type 5,sum (type 6) type 6 from (
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, optional field 1, optional field 2,count (primary key field) type 1,0 type 2,0 type 3,0 type 4,0 types type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2
UNION ALL
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, optional field 1, optional field 2,0 type 1,count (primary key field) type 2,0 type 3,0 type 4,0 type 5,0 type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2
UNION ALL
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, AutoShape Field 1, optional field 2,0 type 1,0 type 2,count (primary key field) type 3,0 type 4,0 type 5,0 type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2
UNION ALL
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, AutoShape Field 1, optional field 2,0 type 1,0 type 2,0 type 3,count (primary key field) type 4,0 type 5,0 type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2
UNION ALL
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, AutoShape Field 1, optional field 2,0 type 1,0 type 2,0 type 3,0 type (primary key field) type 4,count type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2
UNION ALL
Select To_date (to_char (date, ' Yyyy-mm-dd '), ' yyyy-mm-dd ') date, optional field 1, optional field 2,0 type 1,0 type 2,0 type 3,0 type types 4,0 (primary key field) type 6 from Table name
where 1=1
Group BY To_date (To_char (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2) where 1=1 Group by to_date (date, ' Yyyy-mm-dd '), ' Yyyy-mm-dd '), optional field 1, optional field 2