Hi
I've been looking at this for hours now and can't figure out what I'm doing wrong.
I've created a crosstab report and it's working fine except I can't get columns sorted.
The crosstab report reports 36 quarters ending in the last day of quarter. The columns are jumbled.
select 'dbr.title','Cash Flow based on Budgets for Years 2015 - 2017';
select 'dbr.crosstab',4;
select 'dbr.summary.text',2, 'Grand Total';
select 'dbr.hsum',5;
select 'dbr.hdr',1;
select 'dbr.hdr',2;
select 'dbr.sum',5;
select 'dbr.colstyle',1,'[font-weight:bold;color:blue;]';
select 'dbr.colstyle',2,'[font-weight:bold;]';
select 'dbr.colstyle',5,'%0.0F;-;[color:red;border-bottom-style:none;](%0.0F)';
select 'dbr.footer.colstyle', 5,'[font-weight:bold]%0.0F;-;[color:red;font-weight:bold;border-color: black;](%0.0F);';
select 'dbr.css', '.summary_level2 {background-color: #E8E3E3; border-top-style: solid;border-bottom-style: solid;border-width: 1px;border-color: black;}';
select 'dbr.css', '.summary_level1 {background-color: #C5C6C9; border-top-style: solid;border-bottom-style: solid;border-width: 3px;border-color: black; color: blue;font-weight:bold}';
select 'dbr.css', '.summary_level0 {background-color: #E0F7FF; border-top-style: double;border-bottom-style: double;border-width: 3px; border-color: black;color: green;font-weight:bold;}';
select c.tblCustomer_Name as 'Company[Comp]', b.Site_Name as 'Site[Site]', a.Cat as '[Cat]', date_format(MAKEDATE(YEAR("2015-01-01"), 1) + INTERVAL a.CQTR QUARTER - INTERVAL 1 DAY, '%b-%y') as 'Quarter[QTR]', ifnull(a.CValue,0) as '£[CValue]' from cashflow_tmp a join hilmark.tblsitesjake b on a.CSiteID = b.Site_ID join hilmark.tblcustomers_j c on b.Site_Company = c.tblCustomer_ID order by c.tblCustomer_Name,b.Site_Name,a.CatID,a.CQTR;
As you can see I would like to sort on a.CQTR which is the a number representing the quarters and runs from 1 to 12 ie 3 years.
Another thing is it possible to get total of the individual categories in the summary levels? What I mean is that summary for column 1 is it possible to see the totals for each of the categories (column 3)?
Thanks
Jake