I have this sql query:
SELECT DISTINCT
[Card NO],
[User Name],
(
SELECT
MIN(DateTime) AS [Enter Time],
MAX(DateTime) AS [Exit Time],
MAX(DateTime) - MIN(DateTime) AS [Inside Hours]
FROM
ExcelData
)
FROM
ExcelData
GROUP BY
[Card NO], [User Name], DateTime
Table: CardNO | UserName | DateTime
I tried to execute it, but to no avail. I say this is an invalid request. Can anyone find something wrong in this query?
source
share