我在我的项目中使用了四个表,分别是 VehicleMaster、OwnerMaster、CustomerMaster 和 CustomerVehicle
顾名思义,前三个是主表,最后一个表 (CustomerVehicle) 包含 CustomerID 和 VehicleID。表层次结构如下
OwnerMaster (OwnerID, OwnerName)
VehicleMaster (VehicleID, OwnerID, VehicleDetails blah blah...)
CustomerMaster (CustomerID, CustomerName..)
CustomerVehicle (CustomerID, VehicleID)
现在我想知道每个车主有多少辆车在运行。输出应该是这样的。
OwnerName, TotalVehicles, No of Running Vehicles, NonRunning Vehicles.
xxxx, 40, 34, 6
任何帮助都感激不尽。谢谢,