UPDATE VS4TFlight Set TFliTotalTour=0 where TFliTotalTour is null
GO
UPDATE VS4TFlight Set TFliTotalGuide=0 where TFliTotalGuide is null
GO
UPDATE VS4TFlight Set TFliTotalTourLead=0 where TFliTotalTourLead is null
GO
UPDATE VS4TFlight Set TFliTotalEmp=0 where TFliTotalEmp is null
GO
UPDATE VS4TFlight Set TFliTotalDriver=0 where TFliTotalDriver is null
GO
UPDATE VS4TFlight Set TFliTotalGPark=0 where TFliTotalGPark is null
GO
UPDATE VS4TFlight Set TFliGrandTotal=TFliTotalTour +TFliTotalGuide + TFliTotalTourLead + TFliTotalEmp + TFliTotalDriver + TFliTotalGPark
GO
UPDATE VS4TFlight Set TFliTotalQGuide=(select count(TFlGTFliNo) from VS4TFlightGuide where VS4TFlightGuide.Tflgtflino=VS4TFlight.TFliNo) where TFliTotalQGuide is null
GO
UPDATE VS4TFlight Set TFliTotalQEmp=(select count(TFleTFliNo) from VS4TFlightEmployee where VS4TFlightemployee.Tfletflino=VS4TFlight.TFliNo) where TFliTotalQEmp is null
GO
UPDATE VS4TFlight Set TFliTotalQVehicle=(select count(TFvhTFliNo) from VS4TFlightVehicle where VS4TFlightVehicle.TFVhTFliNo =VS4TFlight.TFliNo) where TFliTotalQVehicle is null
GO