如何使用ireport在oracle数据库中选择最大列数

如何使用ireport在oracle数据库中选择最大列数,oracle,jasper-reports,Oracle,Jasper Reports,我想为列选择最大值。我试着用maxinodometer,但它给了我一个机会 错误:没有单个组函数 以下就是我正在做的事情: Select tm.actualstartdate, tm.actualduration, tm.returndate, tm.documentno, tm.dateofrequest, **max(tm.inodometer)** (select registration from tm_vehicle where tm_vehicle_id=tm.tm_vehicle

我想为列选择最大值。我试着用maxinodometer,但它给了我一个机会

错误:没有单个组函数

以下就是我正在做的事情:

Select tm.actualstartdate, tm.actualduration, tm.returndate, tm.documentno, tm.dateofrequest, **max(tm.inodometer)**

(select registration from tm_vehicle where tm_vehicle_id=tm.tm_vehicle_id) as regnumber,

from tm_trips tm where tm.TM_Trips_ID=$P{RECORD_ID}

在对列执行MAX、MIN、SUM等聚合函数时,您必须将所有其他列放在group by中。

您需要在所有非聚合列上使用group by。任何其他方法都可能重复,以获得另一列筛选的最大列值,因为我的查询太长,无法在group by子句之后重复整个查询。请在您的选择中使用内联查询。类似于:选择val1,从x选择maxval2,其中y=z maxval来自选项卡。检查数据集的性能是否可以接受。
Select tm.actualstartdate, tm.actualduration, tm.returndate, tm.documentno, tm.dateofrequest, **max(tm.inodometer)**,
(select registration from tm_vehicle where tm_vehicle_id=tm.tm_vehicle_id) as regnumber from tm_trips tm where tm.TM_Trips_ID=$P{RECORD_ID}
**GROUP BY tm.actualstartdate, tm.actualduration, tm.returndate, tm.documentno, tm.dateofrequest, select registration from tm_vehicle where tm_vehicle_id=tm.tm_vehicle_id)**