HI是否可以存储变量以允许我使用上一个提示中的日期?例如,如果我提示用户2个日期,如下所示: -
WHERE LatestGamma.ConfirmedPortingDate Between [Please Provide 1st Date (dd/mm/yyyy)] And [Please Provide 2nd Date (dd/mm/yyyy)];
然后我想使用提示的ConfirmedPorting日期中的相同日期: - AND LatestGamma.ProposedPortingDate Between [VariableName1stDateFromPrompt] And [VariableName2ndDateFromPrompt];
这可以通过访问来完成吗?
这是我在与Gord谈话后修改后的代码仍然无法按预期工作,如果我将参数保留在其中并且如果我将它们取出则运行它的错误,但结果会拉入不符合IE Confirmed标准的记录建议日期与提示日期不同:
PARAMETERS
[Please Provide 1st Date (dd/mm/yyyy)] DateTime,
[Please Provide 2nd Date (dd/mm/yyyy)] DateTime;
SELECT LatestGamma.OrderId, LatestGamma.MainNumber, LatestGamma.LineType, LatestGamma.Company, LatestGamma.CPStatus, LatestGamma.ConfirmedPortingDate, LatestGamma.ProposedPortingDate, LatestGamma.RequestedDate
FROM LatestGamma
WHERE LatestGamma.ConfirmedPortingDate Between [Please Provide 1st Date (dd/mm/yyyy)] And [Please Provide 2nd Date (dd/mm/yyyy)]
OR LatestGamma.ProposedPortingDate Between [Please Provide 1st Date (dd/mm/yyyy)] And [Please Provide 2nd Date (dd/mm/yyyy)]
ORDER BY LatestGamma.Company;
答案 0 :(得分:3)
是的,您可以重复使用相同的参数名称,只会为每个参数提示一次用户。为清楚起见,您可能希望在查询中添加PARAMETERS前缀,例如
PARAMETERS
[Please Provide 1st Date (yyyy/mm/dd)] DateTime,
[Please Provide 2nd Date (yyyy/mm/dd)] DateTime;
SELECT stuff FROM wherever
WHERE LatestGamma.ConfirmedPortingDate Between [Please Provide 1st Date (yyyy/mm/dd)] And [Please Provide 2nd Date (yyyy/mm/dd)]
AND LatestGamma.ProposedPortingDate Between [Please Provide 1st Date (yyyy/mm/dd)] And [Please Provide 2nd Date (yyyy/mm/dd)];