同样一条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级灰','粗灰'))
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级灰','粗灰'))
...全文
相关推荐
Visual studio C# 开发数据库的Window窗体应用程序 包含查询、增加、删除、修改
ADO.NET包含四个主要组件:Connection(连接)、Command(命令)、DataReader(数据读取器)和DataAdapter(数据适配器)。
利用ROW_NUMBER() OVER函数给SQL数据库中每一条记录分配行号的方法
ROW_NUMBER() OVER函数是SQL Server中的窗口函数(Window Function)之一,它能为数据集中的每一行返回一个唯一的行号,这个行号可以根据指定的排序规则(ORDER BY
SAS.9.2.SQL.Query.Window.Users.Guide
#### 二、SQL Query Window 示例详解**2.1 设置环境**- **环境准备**:在开始使用 SQL Query Window 之前,需要设置好工作环境,包括连接到所需的数据源、加载必要的数据集等
Expert T-SQL Window Functions in SQL Server(Apress,2015)
"Expert T-SQL Window Functions in SQL Server 是一本专著,旨在将读者从对窗口函数的任何知识水平提升到专家级别,利用这些强大功能解决T-SQL查询中的各种问
Window2003服务器安全配置方案 AND sql防注入等
Window2003服务器安全配置方案 AND sql防注入等Window2003服务器安全配置方案是指为了确保Window2003服务器的安全运行,防止各种安全问题的发生,需要对服务器进行相应


