Create View – Declare a variable
You can’t declare variables in a view. Could you make it into a function or stored procedure? Edit – you might also be able to put something into a CTE (Common Table Expression) and keep it as a view. e.g. WITH conditions as ( … do the STUFF here ) SELECT blah FROM blah INNER … Read more