查询报表时的关键代码:SELECT dbo.ChargeAccountingLog.PrecinctID,
dbo.Precinct.PrecinctName,
dbo.ChargeAccountingLog.BuildingID,
dbo.Building.BuildingName,
dbo.ChargeAccountingLog.FloorID, dbo.Floor.FloorName,
dbo.ChargeAccountingLog.RoomID,
dbo.ChargeAccountingMaster.MasterName,
dbo.ChargeAccountingLog.ChargeYear,
dbo.ChargeAccountingLog.ChargeMonth,
dbo.GeneralCode.Code, dbo.GeneralCode.Description,
ISNULL(dbo.ChargeAccountingLog.EmployeeID, '空') AS aa,
ISNULL(dbo.Employee.EmployeeName, '空') AS bb,
dbo.ChargeAccountingLog.PaymentPay AS vv
FROM dbo.ChargeAccountingLog INNER JOIN
dbo.Floor ON dbo.ChargeAccountingLog.PrecinctID = dbo.Floor.PrecinctID AND
dbo.ChargeAccountingLog.BuildingID = dbo.Floor.BuildingID AND
dbo.ChargeAccountingLog.FloorID = dbo.Floor.FloorID INNER JOIN
dbo.Building ON dbo.Floor.PrecinctID = dbo.Building.PrecinctID AND
dbo.Floor.BuildingID = dbo.Building.BuildingID INNER JOIN
dbo.Precinct ON dbo.Building.PrecinctID = dbo.Precinct.PrecinctID INNER JOIN
dbo.GeneralCode ON
dbo.ChargeAccountingLog.ChargeID = dbo.GeneralCode.FriendKeyID INNER JOIN
dbo.ChargeAccountingMaster ON
dbo.ChargeAccountingLog.PrecinctID = dbo.ChargeAccountingMaster.PrecinctID AND
dbo.ChargeAccountingLog.BuildingID = dbo.ChargeAccountingMaster.BuildingID AND
dbo.ChargeAccountingLog.RoomID = dbo.ChargeAccountingMaster.RoomID AND
dbo.ChargeAccountingLog.FloorID = dbo.ChargeAccountingMaster.FloorID AND
dbo.ChargeAccountingLog.ChargeYear = dbo.ChargeAccountingMaster.ChargeYear AND
dbo.ChargeAccountingLog.ChargeMonth = dbo.ChargeAccountingMaster.ChargeMonth LEFT
OUTER JOIN
dbo.Employee ON
dbo.ChargeAccountingLog.EmployeeID = dbo.Employee.EmployeeID
机器的配置是浪潮的服务器 软件和数据库在一台机器上,并且在其他的品牌的服务器也是这样。