i make a view in sql server and throw an error:
USE BaseDeDatos;
CREATE VIEW TEMAS_USUARIO
AS
SELECT TOP 5 t.id_userTopic, t.nameTopic, u.id_user, u.name
FROM Topic t, Users u
WHERE t.id_userTopic = u.id_group
ORDER BY t.id_topic DESC;
what is wrong whit the syntax? error ---> CREATE VIEW TEMAS_USUARIO can´t use LIMIT
The SQL SELECT TOP Clause:
SQL SERVER / MS ACCESS Syntax
MySQL Syntax
SQL SELECT TOP Clause explanation: Here
The syntax command of CREATE VIEW you have this:
The SELECT clauses in a view definition cannot include the following:
Important note Important
The ORDER BY clause is used only to determine the rows that are returned by the TOP or OFFSET clause in the view definition. The ORDER BY clause does not guarantee ordered results when the view is queried, unless ORDER BY is also specified in the query itself.