sql - UNION SELECT after fetch and offset -
i have following stored procedure:
@offset int, @fetch int select col1 col tab1 union select col1 tab2 order col offset @offset rows fetch next @fetch rows
now want add third table union, after offset , fetch has been executed. possible?
union select top 1 col1 tab3 order newid()
@offset int, @fetch int cte1 (select top 100 percent col1 col tab1 union select top 100 percent col1 tab2 order col offset @offset rows fetch next @fetch rows only) select * cte1 union select top 1 col1 tab3 order newid()
Comments
Post a Comment