select sum (Month_KM)Month_KM from Base_VehicleFuel group by Car_ID, MONTH(CONVERT(datetime,month,120))
select ID ,tb.Fuel_Quota,('浙F'+Car_Num ) as Car_Num,dbo.Base_Car.Car_Brand,RoadCode_Num,Actual_Consumption ,Month_KM ,
(Actual_Consumption/Month_KM*100)as BKM_Fuel ,Freight_Volume ,(Freight_Volume/250) as Tra_Allowance,
(tb.Fuel_Quota * Month_KM/100 - Actual_Consumption+ isnull((Freight_Volume/250) ,0) ) as Ultra_Oil,Oil_Price ,
((tb.Fuel_Quota * Month_KM/100 - Actual_Consumption+ isnull((Freight_Volume/250) ,0) )*Oil_Price) as Section_Amount,
V.Month, dbo.Base_Organization.Organization_Name
from Base_VehicleFuel V
left join Base_Organization on V.Organization_ID=Base_Organization.Organization_ID
left join Base_RoadCode on V.RoadCode_ID=Base_RoadCode.RoadCode_ID
left join Base_Car on V.Car_ID=Base_Car.Car_ID
left join (
select Car_Brand , '01' as Month , January as Fuel_Quota from Base_Car union
select Car_Brand , '02' as Month , February as Fuel_Quota from Base_Car union
select Car_Brand , '03' as Month , March as Fuel_Quota from Base_Car union
select Car_Brand , '04' as Month , April as Fuel_Quota from Base_Car union
select Car_Brand , '05' as Month , May as Fuel_Quota from Base_Car union
select Car_Brand , '06' as Month , June as Fuel_Quota from Base_Car union
select Car_Brand , '07' as Month , July as Fuel_Quota from Base_Car union
select Car_Brand , '08' as Month , August as Fuel_Quota from Base_Car union
select Car_Brand , '09' as Month , September as Fuel_Quota from Base_Car union
select Car_Brand , '10' as Month , October as Fuel_Quota from Base_Car union
select Car_Brand , '11' as Month ,November as Fuel_Quota from Base_Car union
select Car_Brand , '12' as Month ,December as Fuel_Quota from Base_Car ) tb
on Base_Car.Car_Brand= tb.Car_Brand and SUBSTRING(V.Month,6,2)=tb.Month and tb.Fuel_Quota is not null