i get an error with this query
select ID, ROW_NUMBER() OVER(ORDER BY ID) as num from T_TASK where ROW_NUMBER() = 5
and this one
select ID, ROW_NUMBER() OVER(ORDER BY ID) as num from T_TASK where num = 4
whats wrong with the queries?
i get an error with this query
select ID, ROW_NUMBER() OVER(ORDER BY ID) as num from T_TASK where ROW_NUMBER() = 5
and this one
select ID, ROW_NUMBER() OVER(ORDER BY ID) as num from T_TASK where num = 4
whats wrong with the queries?
Use a subquery:
SELECT ID
FROM (
SELECT ID, ROW_NUMBER() OVER(ORDER BY ID) AS num
FROM T_TASK
) T1 WHERE num = 5
SELECT ID
FROM
(select ID, ROW_NUMBER() OVER(ORDER BY ID) as rownum from T_TASK) dr
WHERE rownum = 5
1 You can't use windows functions directly on the WHERE clause
2 The same is applied to alias name too