I have 2 tables.
The first table is a directory of my vehicles, and the second one is a table where I have the date and odometer reading of that vehicle (there might be more than 1 trip per day per vehicle). I want to have an output where I can have some analysis of whether a vehicle has odometer readings. Some of them could be reported as 0, which is what I want to be able to see or even maybe have no data at all.
TBLVehicles:
Vehicle Group
-----------------
100 A
101 A
102 B
103 B
104 C
105 C
TBLTrips:
Vehicle StartDate Odometer
-----------------------------------------
100 2018-01-12 100
101 2018-05-12 1000
101 2018-05-12 1010
103 2018-05-12 500
103 2018-06-12 505
105 2018-06-12 0
105 2018-06-12 0
I would like getting an output like the one below where I can see which vehicle has a valid odometer per day in a specified date range. It would even be nice to have a total column at the end to see which ones have absolutely no odometer in that date range.
OUTPUT
Vehicle Group 2018-01-12 2018-02-12 2018-03-12 2018-04-12 2018-05-12 2018-06-12
----------------------------------------------------------------------------------
100 A 1 0 0 0 0 0
101 A 0 0 0 0 2 0
102 B 0 0 0 0 0 0
103 B 0 0 0 0 1 1
104 C 0 0 0 0 0 0
105 C 0 0 0 0 0 2

