Skip to content

Tag: sql-server

Combine Queries using Union All Dynamically

I have three tables: I combined those tables using UNION ALL. My problem is, each year there is a new table to be added. One example is that Table D with corresponding record Order O1-20 and Year 2020. Instead of adding another set of UNION ALL, is there any other way to achieve the same result. I’m usi…