我有一个看起来像这样的查询:
SELECT
col1
,...
,col3
,(SELECT col3 FROM table where <clause>) AS MinPickTime
,(SELECT col3 FROM table where <clause>) AS MaxPickTime
,DATEDIFF(d, MinPickTime, MaxPickTime)
FROM table
但是 DATEDIFF 行不喜欢别名列。
简而言之,如何给 DATEDIFF 一个由子查询派生的别名列?