I'm writing a page that will create a query (for non-db users) and it create the query and run it returning the results for them.
I am using row_number
to handle custom pagination.
How do I do a left join and a row_number
in a subquery when I don't know the specific columns I need to return. I tried to use *
but I get an error that
The column '' was specified multiple times
Here is the query I tried:
SELECT * FROM
(SELECT ROW_NUMBER() OVER (ORDER BY Test) AS ROW_NUMBER, *
FROM table1 a
LEFT JOIN table2 b
ON a.ID = b.ID) x
WHERE ROW_NUMBER BETWEEN 1 AND 50