我有一个存储过程,我想在 from 和 to date 之间进行搜索,但是:
if @FromDate is not null and @ToDate is not null then
vSaleDetail.date between @FromDate and @ToDate
if @FromDate is not null and @ToDate is null then
vSaleDetail.date = @FromDate
if @FromDate is null and @ToDate is then
Return All
这就是我所拥有的,但它不起作用
where
(((@FromDate is null and @ToDate is null) OR (vSaleDetail.date between @FromDate and @ToDate ))
AND ((@FromDate is null) OR (vSaleDetail.date = @FromDate)))
请帮忙——我需要做些什么来修复它?