I have a dimension table in SQL Server that stores values with change history in the following format:
[Position_History]
Position          Person    Inserted     Deleted
Sales 1           Mark      2019-01-01   2019-02-01
Sales 2           Mark      2019-02-01   2019-05-01
Sales 3           Mark      2019-05-01   2020-07-01
Senior Developer  Peter     2019-01-01   2020-07-01
Junior Developer  John      2019-01-01   2019-04-01
Project Manager   John      2019-04-01   2020-07-01
Inserted = date of record insertion.
Deleted = date of record being updated.
When querying state of positions for a specific date a simple where query would suffice:
SELECT Position, Person FROM Position_History WHERE Inserted <= '2019-05-01' AND Deleted > '2019-05-01'
With result:
Position          Person
Sales 3           Mark 
Senior Developer  Peter
Project Manager   John
However I don't know which approach to use to create a query that would return me results for a list of dates. For example I would like to know state on 3 consecutive months - '2019-03-01', '2019-04-01', '2019-05-01'
The results I'm looking for would be:
Position          Person  Date
Sales 2           Mark    2019-03-01
Senior Developer  Peter   2019-03-01
Junior Developer  John    2019-03-01
Sales 2           Mark    2019-04-01
Senior Developer  Peter   2019-04-01
Project Manager   John    2019-04-01
Sales 3           Mark    2019-05-01
Senior Developer  Peter   2019-05-01
Project Manager   John    2019-05-01
I am looking for approach that would accept parameters dynamically as list of parameters or table, avoiding hardcoding union of x queries.
Thanks for help!
 
     
    