I have an sql query that returns rows from two tables with same column names. I need a row number of all records in a complete result set.
Following is the query
select Id, VersionNumber from documents where id=5
Union all
select Id, VersionNumber from versions where id=5
order by VersionNumber desc
How should it be done?
EDIT: And what if I only need to return a row_num where VersionNumber is lets say 5.
A slightly better way would be :-
Try this:
TO filter by version number 5 use: