我正在尝试查询具有这些参数的数据库:
Transaction Date, User Email Address
我想要的结果表是这些参数:
Email Address, dateDiff
对于 dateDiff,我想找出最早交易日期和最晚交易日期之间的差异。
我该怎么做呢?
我的代码(显然不正确)
SELECT [Email Address], DATEDIFF(day, [Transaction Date],[Transaction Date]) AS 'dateDiff'
FROM [DB].[TABLE]
ORDER BY [dateDiff] Desc