Hi,
I need to present basic Pareto graphs of delay codes etc over, for example, weekly periods. I've created a Dynamic SQL View using @PAR1@ to support the selection of an individual weeks worth of data based on a date selected from a date picker. All of this works fine.
However, I haven't been able to order the report output correctly. The output I get when no sorting is attempted is shown below,
but when I attempt to sort the output appropriately
I get a database error:
I have also tried basing the report on a different view design which presents the data already in weekly groups, but the same problem results. Somehow, I think this problem may relate specifically to my use of the Ingres database, but hopefully I'm just doing something stupid.
If anyone can offer me any advice on how to overcome this problem it would be really appreciated, as Pareto style presentation is one of the fairly basic data presentation methods I need to have available.
Regards,
Greg Shearer
PS
Some more detail.
Extracting from the Ingres log, trying to order within the view gives the following. The error is due to the sql subselect structure. When using the subselect structure, Ingres requires 'order by' to be outside the subselect.
!IIapi_query: queryText = Select DAI_.* FROM (select
ds.machine, ds.event, delays.name,
ds.time as duration, ds.incidents, ds.date
from delay_shift ds, delays
where
date_trunc('week', ds.date) = date_trunc('week', date('2010-09-22')) and
delays.event = ds.event and
ds.event <> 94 and ds.event <> 994 and ds.event <> 97 and ds.time <> 0
union
select
d.machine, d.event, delays.name,
d.time, d.incidents, d.date
from delay d, delays
where
date_trunc('week', d.date) = date_trunc('week', date('2010-09-22')) and
delays.event = d.event and
d.event <> 94 and d.event <> 994 and d.event <> 97 and d.time <> 0
order by machine, duration) DAI_ WHERE 1=2
!DBMS Error: (0x000009C5) line 21, Syntax error on 'order'. The correct syntax is:
SELECT [ALL|DISTINCT] target_list
FROM table(s)
[WHERE search_cond]
[GROUP BY col(s)]
[HAVING search_cond]
[UNION subselect]
[ORDER BY col(s)]
I'm trying to get a trace of what happens when sorting is tried within the report ... but having a few technical problems. I'll post later.