Reputation: 15345
What is wrong with this statement??
SELECT ID, datediff("mi", Start, End) as Total
FROM TimeTable
WHERE Total is not null
I get an error "Invalid column name"
Upvotes: 2
Views: 7177
Reputation: 103589
Don't use reserved words like "End" as table or column names! Use something like TaskStart/TaskEnd or JobStart/JobEnd or StartDate/EndDate, you'll thanks me everytime you don't have to go back and add [] around your table/column names....
Upvotes: 1
Reputation: 59165
Reference the expression, not the alias.
SELECT ID, datediff("mi", Start, [End]) as Total
FROM TimeTable
WHERE datediff("mi", Start, [End]) is not null
EDIT, updated to prevent syntax error for usage of END
Upvotes: 12