我正在为某件事而苦苦挣扎,没有太多时间自己解决。
我的查询:
Select distinct d.delivery_bay_code,dt.diary_type_desc, d.delivery_datetime, ddo.order_no , ddo.company_id_no, ddo.no_of_cartons, s.supplier_name, c.company_name, sk.sku_desc, (pod.deliver_not_after_date)||' '||(pod.deliver_not_before_date)as delivery_window
from diary d , dc_diary_order ddo , purch_order po ,purch_order_carton_sku pocs ,sku sk, purch_order_date pod,supplier s , diary_type dt , company c
where ddo.diary_entry_id_no = d.diary_entry_id_no
and po.order_no = ddo.order_no
and po.company_id_no = ddo.company_id_no
and s.supplier_id_no = po.supplier_id_no
and s.company_id_no = po.company_id_no
and dt.diary_type_code = d.diary_type_code
and c.company_id_no = po.company_id_no
and po.order_no = pocs.order_no
and pocs.sku_id_no = sk.sku_id_no
and po.company_id_no = 2
and ddo.order_no = 1999
order by delivery_datetime;
此查询带回 2 条记录,其中只有delivery_window
不同之处。例如13/APR/11 13/APR/11 and 12/APR/11 12/APR/11
,我希望它只带回最大日期时间(最新日期)。
例如:select max(delivery_datetime) from diary;
现在我已经像这样尝试了上面的查询:
select... max(pod.deliver_not_after_date)||' '||(pod.deliver_not_before_date)as delivery_window ... from
但我得到错误ORA-00937: not a single-group group function