| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 794 人关注过本帖
标题:多条件查询的 条件选择问题 带图
只看楼主 加入收藏
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
快速回复:多条件查询的 条件选择问题 带图
数据加载中...
 
   



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

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