I need to rewrite this query to eliminate duplicates;
I've probably constructed it wrong
I need to use data from these 2 tables on one SSRS report;
They are only related by three fields month, year and class.
Attached is a sample image of the dupes i have in my results.
I have a detail table with vehicle mileage info and a stats table with table i need to display comparison data from a date range of start and end date.
the stats table has the counts for vehicles and the detail table has the mileage breakdown with vehicle ids by year.
My query is based on two separate reporting periods since i prompt for start and end date.
attached is my table layout and the results i am currently getting.
Should the subquery contain the result set with the multiple vehicle ids?
Can i use a group by to help?
I need to do a lot of aggregation on different fields from each table.