您好,
全选的实现思路是,在参数列表里面增加一个all的值。- SELECT TOP 1
- -1 AS 产品ID, '(All)' AS 产品名称
- FROM
- 产品
- UNION
- select 产品ID, 产品名称
- from 产品
复制代码
在进行过滤的时候,增加对这个值得判断-1 in (@Param2))- select 订单.订单ID, 订单.客户ID, 订单.订购日期, 产品.产品名称,订单明细.数量, 订单明细.单价, 订单明细.折扣 from (( 订单
- inner join 订单明细 on 订单.订单ID = 订单明细.订单ID )
- inner join 产品 on 订单明细.产品ID = 产品.产品ID )
- where (订单明细.产品ID in (@Param1) or -1 in (@Param2)) and DateDiff("d",@Param3,订购日期) > 0 and DateDiff("d",@Param4,订购日期) < 0
- order by 订单.订单ID;
复制代码 |