I have a table which looks like this: 
I'm trying to write a query which will return this: 
I'm trying to merge records based on the effect_date, but only if the end_dates are within the effect_date and end_date range.
I have a table which looks like this: 
I'm trying to write a query which will return this: 
I'm trying to merge records based on the effect_date, but only if the end_dates are within the effect_date and end_date range.
select employee , effect_date , max(end_date) end_date , max(clinical_fte) , max(admin_fte) , max(mgmt_fte) , max(other_fte) from table group by employee , effect_date As stated before by Chris Farmer, the second requirement that end date has to be between effect_date and end_date is silly, because it will always be true. I've chosen max for all records you want to merge, because you haven't stated how you want to merge them. Feel free to adjust to your needs ;)
sum(...) on the numerics would be more appropriate?Try this SQL Query:
select * from TABLE where end_date between effect_date and end_date