Category: | Bug report |
Priority: | Normal |
Status: | Assigned |
Project: | Severity: | Minor |
Resolution: | Open |
|
Component: | Reproducibility: | Always |
Assigned to: |
When I try to run the following query in 4.0 and 4.0.1 I get the following error within the query window:
error:Parse error at line 1, column 12. Encountered: Time
It work fine in 3.7.2
SELECT
thruweek,
zip3,
QtyShipped2009,
QtyShipped2010,
QtyShipped2011,
NotScanned2009,
NotScanned2010,
NotScanned2011,
OnTime2009,
(OnTime2009/QtyShipped2009) as Percent2009,
OnTime2010,
(OnTime2010/QtyShipped2010) as Percent2010,
OnTime2011,
(OnTime2011/QtyShipped2011) as Percent2011,
Late2009,
Late2010,
Late2011
FROM
(SELECT
(week(now())-4) as thruweek,
SUBSTRING(zip,1,3) zip3,
sum(if( year(shipping_date)=2009,1,0)) as QtyShipped2009,
sum(if( year(shipping_date)=2010,1,0)) as QtyShipped2010,
sum(if( year(shipping_date)=2011,1,0)) as QtyShipped2011,
sum(if (delivery_status = 'delivered' and year(shipping_date)=2009,0,1)) as NotScanned2009,
sum(if (delivery_status = 'delivered' and year(shipping_date)=2010,0,1)) as NotScanned2010,
sum(if (delivery_status = 'delivered' and year(shipping_date)=2011,0,1)) as NotScanned2011,
sum(if (delivery_status = 'delivered' and year(shipping_date)=2009 and DATEDIFF(delivery_status_date,shipping_date) <= 2, 1,0)) as "OnTime2009",
sum(if (delivery_status = 'delivered' and year(shipping_date)=2010 and DATEDIFF(delivery_status_date,shipping_date) <= 2, 1,0)) as "OnTime2010",
sum(if (delivery_status = 'delivered' and year(shipping_date)=2011 and DATEDIFF(delivery_status_date,shipping_date) <= 2, 1,0)) as "OnTime2011",
sum(if (delivery_status = 'delivered' and year(shipping_date)=2009 and DATEDIFF(delivery_status_date,shipping_date) >= 3, 1,0)) as "Late2009",
sum(if (delivery_status = 'delivered' and year(shipping_date)=2010 and DATEDIFF(delivery_status_date,shipping_date) >= 3, 1,0)) as "Late2010",
sum(if (delivery_status = 'delivered' and year(shipping_date)=2011 and DATEDIFF(delivery_status_date,shipping_date) >= 3, 1,0)) as "Late2011"
FROM ship_history
WHERE
is_chick_shipping = 1
and week(shipping_date)<= week(now())
Group by
zip3
order by
zip3) x
WHERE
((OnTime2009/QtyShipped2009) < .70 or (OnTime2010/QtyShipped2010) < .70) or (OnTime2011/QtyShipped2011) < .7
1 Comment:
Is the problem with the iReport "Report query" editor window?
Or is it a problem with JasperReports running the report?
Can you provide the creation script for ship_history to reproduce the issue?