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"
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"
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
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...