Im trying to get the time difference between two values in a table and eliminate all NULLs.
SELECT NumberOfMinutes =
DATEDIFF(millisecond, tbl_hugo_game.time_start, tbl_hugo_game.time_end)
FROM tbl_hugo_game
WHERE numberofminutes <> NULL
ORDER BY numberofminutes ASC
without the WHERE-clause it is working fine,
otherwise :
Msg 207, Level 16, State 1, Line 3
Invalid column name ‘numberofminutes’.
What’s wrong?
You cannot use column aliases in a
whereclause.You can, however, put the query with the alias as a source for another query, like this: