I have the follwing SQL, and It's giving me psycopg2.ProgrammingError: column "rownum" does not exist
.
SELECT *, (case when col1 = 'A' then
1
when col1 = 'B' then
2
else
3
end) as rownum
from table1
order by colb, rownum, colc