同样一条sql,在command window中能查出数据,sql window却查不出
select *
from (select c.unit_name,c.ash,s.tons zrjh,js.jtons jrjh,w.sumpc zrjo,w.smnet zrl,w1.smnet bylj,w2.smnet bnlj
from (select w1.unit_th,w1.s_type,w1.unit_th||w1.s_type un,sum(w1.net) smnet,sum(w1.price* w1.net) sumpc
from t_weight_info w1
where w1.weigh_date = '2014-07-03' and w1.s_type in('II级灰','III级灰','粗灰')
group by w1.unit_th,w1.s_type) w,
(select w1.unit_th,w1.s_type,w1.unit_th||w1.s_type un,sum(w1.net) smnet,sum(w1.price* w1.net) sumpc
from t_weight_info w1
where w1.weigh_date between '2014-07-01' and '2014-07-03' and w1.s_type in('II级灰','III级灰','粗灰')
group by w1.unit_th,w1.s_type) w1,
(select w1.unit_th,w1.s_type,w1.unit_th||w1.s_type un,sum(w1.net) smnet,sum(w1.price* w1.net) sumpc
from t_weight_info w1
where w1.weigh_date between '2014-01-01' and '2014-07-03' and w1.s_type in('II级灰','III级灰','粗灰')
group by w1.unit_th,w1.s_type) w2,
(select s1.unit_name,s1.s_type,s1.unit_name||s1.s_type un,s1.tons
from t_sale_plan s1
where s1.p_stime between '2014-07-02' and '2014-07-03' and s1.s_type in('II级灰','III级灰','粗灰')) s,
(select s2.unit_name,s2.s_type,s2.unit_name||s2.s_type un,s2.tons jtons
from t_sale_plan s2
where s2.p_stime between '2014-07-03' and '2014-07-04' and s2.s_type in('II级灰','III级灰','粗灰')) js,
(select tc.unit_name,ta.ash,tc.unit_name||ta.ash un from t_client_info tc,t_ash_info ta where ta.ash in('II级灰','III级灰','粗灰')) c
where c.un = w.un(+)
and c.un = s.un(+)
and c.un = w1.un(+)
and c.un = w2.un(+)
and c.un = js.un(+)) ws
where ws.zrl is not null or ws.jrjh is not null or ws.zrjh is not null
or ws.unit_name in (select w1.unit_th from t_weight_info w1 where w1.weigh_date = '2014-07-03' and w1.s_type in('II级灰','III级灰','粗灰'))
or ws.unit_name in (select s1.unit_name from t_sale_plan s1 where s1.p_stime between '2014-07-02' and '2014-07-03' and s1.s_type in('II级灰','III级灰','粗灰'))