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 JOIN conditions
(or CROSS JOIN conditions if its just one row, I can't quite decipher what your data is like)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)