我正在尝试遍历一个表并获取mins
列的总和,但是它总是告诉我这mins
不是有效的列名
SELECT
acs.cid,
DATEDIFF (n, acs.StartTime, acs.EndTime ) as prepromomins,
CASE
WHEN (p.multiplier is null) THEN DATEDIFF (n , acs.StartTime, acs.EndTime)
ELSE (DATEDIFF ( n , acs.StartTime , acs.EndTime ) * p.multiplier)
END AS mins
FROM
activecards as acs
LEFT JOIN Promotions as p
ON acs.StartTime > p.StartTime and acs.EndTime < p.EndTime