我的查询必须在某些日期之间获取客户的报表和某些数据。出于测试目的,我创建了一些测试帐户并使用了完整的查询。
现在我需要在日期之间进行过滤。这是我当前的查询:
SELECT
FechaDeSistema,
Code,
CASE
WHEN DR_Socio = @SocioNum THEN cast(Cantidad as decimal(19,2))
END as Debit,
CASE
WHEN CR_Socio = @SocioNum THEN cast(Cantidad as decimal(19,2))
END AS Credit,
CASE
WHEN DR_Socio = @SocioNum THEN cast(BalanceDebito as decimal(19,2))
WHEN CR_Socio = @SocioNum THEN cast(BalanceCredito as decimal(19,2))
END AS Balance
FROM Ledger
WHERE (Debito_Cuenta = @Acct)
OR (Credito_Cuenta = @Ncct)
AND (FechaDeSistema BETWEEN @Start AND @Final)
ORDER BY FechaDeSistema DESC";
日期的参数由我设置的两个日历给出。但是,当我生成报告时,它仍然显示整个数据范围,从不在我选择的日期之间进行选择。我究竟做错了什么?