An error occurred during local report processing. An error has occurred during report processing. The Group expression used in grouping 'table1_month' returned a data type that is not valid.
- An error occurred during local report processing.
- An error has occurred during report processing.
- The Group expression used in grouping 'table1_month' returned a data type that is not valid.
SELECT CONCAT(MONTHNAME(t1.Date), ' ', YEAR(t1.Date)) Month, SUM(IF(t1.VisitorBrowser='MSIE', 1, 0)) 'IE', SUM(IF(t1.VisitorBrowser='Firefox', 1, 0)) 'FF', SUM(IF(t1.VisitorBrowser='Safari', 1, 0)) 'CS', SUM(IF(t1.VisitorBrowser='Smartphone', 1, 0)) 'Smart', SUM(IF(t1.VisitorBrowser='Other', 1, 0)) 'Other', COUNT(t1.VisitorBrowser) 'Total' FROM (SELECT a.DateTimeStamp Date, CASE WHEN INSTR(a.VisitorUAgent, 'MSIE ') THEN 'MSIE' WHEN INSTR(a.VisitorUAgent, 'Firefox') THEN 'Firefox' WHEN INSTR(a.VisitorUAgent, 'Safari') THEN 'Safari' WHEN INSTR(a.VisitorUAgent, 'Chrome') THEN 'Safari' WHEN INSTR(a.VisitorUAgent, 'BlackBerry') THEN 'Smartphone' WHEN INSTR(a.VisitorUAgent, 'iPhone') THEN 'Smartphone' WHEN INSTR(a.VisitorUAgent, 'Android') THEN 'Smartphone' WHEN INSTR(a.VisitorUAgent, 'NetFront') THEN 'Smartphone' WHEN INSTR(a.VisitorUAgent, 'SonyEricsson') THEN 'Smartphone' ELSE 'Other' END VisitorBrowser FROM custombu_stats_visits a GROUP BY a.VisitorIP ORDER BY a.DateTimeStamp DESC) t1 GROUP BY CONCAT(MONTH(t1.Date), ' ', YEAR(t1.Date))
- SELECT
- CONCAT(MONTHNAME(t1.Date), ' ', YEAR(t1.Date)) Month,
- SUM(IF(t1.VisitorBrowser='MSIE', 1, 0)) 'IE',
- SUM(IF(t1.VisitorBrowser='Firefox', 1, 0)) 'FF',
- SUM(IF(t1.VisitorBrowser='Safari', 1, 0)) 'CS',
- SUM(IF(t1.VisitorBrowser='Smartphone', 1, 0)) 'Smart',
- SUM(IF(t1.VisitorBrowser='Other', 1, 0)) 'Other',
- COUNT(t1.VisitorBrowser) 'Total'
- FROM
- (SELECT
- a.DateTimeStamp Date,
- CASE
- WHEN INSTR(a.VisitorUAgent, 'MSIE ') THEN 'MSIE'
- WHEN INSTR(a.VisitorUAgent, 'Firefox') THEN 'Firefox'
- WHEN INSTR(a.VisitorUAgent, 'Safari') THEN 'Safari'
- WHEN INSTR(a.VisitorUAgent, 'Chrome') THEN 'Safari'
- WHEN INSTR(a.VisitorUAgent, 'BlackBerry') THEN 'Smartphone'
- WHEN INSTR(a.VisitorUAgent, 'iPhone') THEN 'Smartphone'
- WHEN INSTR(a.VisitorUAgent, 'Android') THEN 'Smartphone'
- WHEN INSTR(a.VisitorUAgent, 'NetFront') THEN 'Smartphone'
- WHEN INSTR(a.VisitorUAgent, 'SonyEricsson') THEN 'Smartphone'
- ELSE 'Other'
- END VisitorBrowser
- FROM
- custombu_stats_visits a
- GROUP BY
- a.VisitorIP
- ORDER BY
- a.DateTimeStamp DESC) t1
- GROUP BY
- CONCAT(MONTH(t1.Date), ' ', YEAR(t1.Date))
CONCAT(MONTHNAME(t1.Date), ' ', YEAR(t1.Date)) AS Month
- CONCAT(MONTHNAME(t1.Date), ' ', YEAR(t1.Date)) AS Month
This will return the SQL date but using your report builder or business intelligence development studio, you can specify in the report designer how to format the returned value to a more user-friendly date format (such as Month name then year - eg. November 2010).
I have been told that data types are a nightmare in SQL Server Reporting Services and that all data types should be kept in their original state and then queried in the same state.