Query multiple tables with same structure dynamically I have a problem which I am struggling to find a solution for in SQL.