标题:多条件查询的 条件选择问题 带图
只看楼主
shulei521521
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2007-8-7
 问题点数:0 回复次数:1 
多条件查询的 条件选择问题 带图
SELECT SUM(T_Goods_Day_Sale.inprc * T_Goods_Day_Sale.qty) AS chengben,
SUM(T_Goods_Day_Sale.ramt) AS ramt, SUM(T_Goods_Day_Sale.ramt)
- SUM(T_Goods_Day_Sale.inprc * T_Goods_Day_Sale.qty) AS maoli,
(SUM(T_Goods_Day_Sale.ramt)
- SUM(T_Goods_Day_Sale.inprc * T_Goods_Day_Sale.qty))
/ SUM(T_Goods_Day_Sale.ramt) * 100 AS maolilv,
T_Goods_Day_Sale.sale_date
FROM T_Goods_Day_Sale INNER JOIN
T_Store ON T_Goods_Day_Sale.store_id = T_Store.store_id
WHERE (T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.store_type = @store_type OR
@store_type IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.store_type = @store_type OR
@store_type IS NULL) AND (T_Store.store_name = @store_name OR
@store_name IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.store_name = @store_name OR
@store_name IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.area = @area OR
@area IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.store_type = @store_type OR
@store_type IS NULL) AND (T_Store.area = @area OR
@area IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL) AND (T_Store.store_type = @store_type OR
@store_type IS NULL) AND (T_Store.store_name = @store_name OR
@store_name IS NULL) AND (T_Store.area = @area OR
@area IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.area = @area OR
@area IS NULL) OR
(T_Goods_Day_Sale.sale_date BETWEEN @dateB AND @dateE) AND
(T_Store.Mgr_id = @mgr_id OR
@mgr_id IS NULL)
GROUP BY T_Goods_Day_Sale.sale_date
搜索更多相关主题的帖子: Goods Sale Day SUM 选择问题 
2007-08-25 11:56
shulei521521
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2007-8-7
得分:0 

满足这个条件 却把哪个条件查出来了 或者是满个一个大条件 只能查到大条件


2007-08-25 12:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-165342-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.065776 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved