I have a the following sql statement:
$sql = "select siteid, row_number() OVER (ORDER BY siteid) as rownum FROM nwsite WHERE rownum >= 4";
"rownum" works when i use the name outside of the query (e.g. in a foreach loop) but when it comes to using it as a WHERE clause it never works.
Any ideas?
Thanks
One option is to
rownum
alias in the outer querySQL Statement
select *
from (
select siteid
, row_number() OVER (ORDER BY siteid) as rownum
FROM nwsite
) q
where rownum >= 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With