各位大虾,以下是在datawindow里sql,在设计的时候,我直接retrieve,都没问题。我以前也碰到过,也是用了子查询才出现。谢谢各位大虾。
SELECT in_out_ph_room.order_on,
in_out_ph_room.do_time,
in_out_ph_room.oper_id,
in_out_ph_room.acc_write,
in_out_ph_room.acc_date,
in_out_ph_room.do_total,
in_out_ph_room.ylsje,
in_out_ph_room.jz_set,
in_out_ph_room.bill_type,
(select unit_name from yk_unit_id where unit_id = provider_unit) as provider_name,
(select unit_name from yk_unit_id where unit_id = to_unit) as to_name,
in_out_ph_room.to_unit,
in_out_ph_room.provider_unit
FROM in_out_ph_room where (acc_date >= :dt_from and acc_date <= :dt_to) and
(provider_unit = :s_unit or to_unit = :s_unit)
看不出问题,你把 (select unit_name from yk_unit_id where unit_id = provider_unit) as provider_name,
(select unit_name from yk_unit_id where unit_id = to_unit) as to_name,
改成关联试下。