SELECT * FROM (SELECT SID2.*, tCentre.Description AS "Centre", tActivity.Description AS "Activity", tElement.ElementCode AS "Element", tSubledger.Description AS "Subledger", tValidAccountNumber.AccountNo, tApplication.Description AS "Application", tServiceKPI.KpiNumber FROM ((((((((SELECT SID.*, CAST(SID.ServiceCode as varchar(60)) AS vServiceCode, tServiceType.Code, tServiceType.Description AS ServiceType, tServiceType.ExpenseElementID, tCustomer.ID AS CustomerID, tCustomer.ShipTo, tCustomer.FullName AS Customer, tServiceType.SystemID, tCentre.Description AS CustomerCentre, tActivity.Description AS CustomerActivity, tElement.ElementCode AS CustomerElement, tSubledger.Description AS CustomerSubledger, tGroup.Description AS GroupDesc, tDepartment.Description AS Department, tLocation.Description AS Location, tPerson.Person FROM (((((((((tServiceID AS SID LEFT JOIN tServiceType ON ((SID.ServiceTypeID = tServiceType.ID) AND (tServiceType.Active = 1))) LEFT JOIN tCentre ON ((SID.CustomerCentreID = tCentre.ID) AND (tCentre.Active = 1))) LEFT JOIN tActivity ON ((SID.CustomerActivityID = tActivity.ID) AND (tActivity.Active = 1))) LEFT JOIN tElement ON ((SID.CustomerElementID = tElement.ID) AND (tElement.Active = 1))) LEFT JOIN tLocation ON ((SID.LocationID = tLocation.ID) AND (tLocation.Active = 1))) LEFT JOIN tSubledger ON ((SID.CustomerSubledgerID = tSubledger.ID) AND (tSubledger.Active = 1))) LEFT JOIN tDepartment ON ((tCentre.DepartmentID = tDepartment.ID) AND (tDepartment.Active = 1))) LEFT JOIN tGroup ON ((tDepartment.GroupID = tGroup.ID) AND (tGroup.Active = 1))) LEFT JOIN tCustomer ON ((tGroup.CustomerID = tCustomer.ID) AND (tCustomer.Active = 1))) LEFT JOIN tPerson ON ((SID.PersonID = tPerson.ID) AND (tPerson.Active = 1))) AS SID2 LEFT JOIN tCentre ON ((SID2.CentreID = tCentre.ID) AND (tCentre.Active = 1))) LEFT JOIN tActivity ON ((SID2.ActivityID = tActivity.ID) AND (tActivity.Active = 1))) LEFT JOIN tElement ON ((SID2.ExpenseElementID = tElement.ID) AND (tElement.Active = 1))) LEFT JOIN tSubledger ON ((SID2.SubledgerID = tSubledger.ID) AND (tSubledger.Active = 1))) LEFT JOIN tSystem ON ((SID2.SystemID = tSystem.ID) AND (tSystem.Active = 1))) LEFT JOIN tBatchType ON ((tSystem.BatchTypeID = tBatchType.ID) AND (tBatchType.Active = 1))) LEFT JOIN tValidAccountNumber ON ((tBatchType.ID = tValidAccountNumber.BatchTypeID) AND (tValidAccountNumber.Active = 1))) LEFT JOIN tApplication ON SID2.ApplicationID = tApplication.ID LEFT JOIN tServiceKPI ON SID2.ServiceKpiID = tServiceKPI.ID) AS SD WHERE ServiceID LIKE '02%' AND Active = 1 ORDER BY ServiceID *****************************************************************8 SELECT * FROM ( SELECT SID2.*, tCentre.Description AS "Centre", tActivity.Description AS "Activity", tElement.ElementCode AS "Element", tSubledger.Description AS "Subledger", tValidAccountNumber.AccountNo, tApplication.Description AS "Application", tServiceKPI.KpiNumber, tServiceMnemonic.ServiceCode AS "ServiceMnemonicCode" FROM ( (((((((SELECT SID.*, CAST(SID.ServiceCode as varchar(60)) AS vServiceCode, tServiceType.Code, tServiceType.Description AS ServiceType, tServiceType.ExpenseElementID, tCustomer.ID AS CustomerID, tCustomer.ShipTo, tCustomer.FullName AS Customer, tServiceType.SystemID, tCentre.Description AS CustomerCentre, tActivity.Description AS CustomerActivity, tElement.ElementCode AS CustomerElement, tSubledger.Description AS CustomerSubledger, tGroup.Description AS GroupDesc, tDepartment.Description AS Department, tLocation.Description AS Location, tPerson.Person FROM ( ( ( ( ( ( ( ( (tServiceID AS SID LEFT JOIN tServiceType ON ((SID.ServiceTypeID = tServiceType.ID) AND (tServiceType.Active = 1))) LEFT JOIN tCentre ON ((SID.CustomerCentreID = tCentre.ID) AND (tCentre.Active = 1))) LEFT JOIN tActivity ON ((SID.CustomerActivityID = tActivity.ID) AND (tActivity.Active = 1))) LEFT JOIN tElement ON ((SID.CustomerElementID = tElement.ID) AND (tElement.Active = 1))) LEFT JOIN tLocation ON ((SID.LocationID = tLocation.ID) AND (tLocation.Active = 1))) LEFT JOIN tSubledger ON ((SID.CustomerSubledgerID = tSubledger.ID) AND (tSubledger.Active = 1))) LEFT JOIN tDepartment ON ((tCentre.DepartmentID = tDepartment.ID) AND (tDepartment.Active = 1))) LEFT JOIN tGroup ON ((tDepartment.GroupID = tGroup.ID) AND (tGroup.Active = 1)) ) LEFT JOIN tCustomer ON ((tGroup.CustomerID = tCustomer.ID) AND (tCustomer.Active = 1)) ) LEFT JOIN tPerson ON ((SID.PersonID = tPerson.ID) AND (tPerson.Active = 1)) ) AS SID2 LEFT JOIN tCentre ON ((SID2.CentreID = tCentre.ID) AND (tCentre.Active = 1))) LEFT JOIN tActivity ON ((SID2.ActivityID = tActivity.ID) AND (tActivity.Active = 1))) LEFT JOIN tElement ON ((SID2.ExpenseElementID = tElement.ID) AND (tElement.Active = 1))) LEFT JOIN tSubledger ON ((SID2.SubledgerID = tSubledger.ID) AND (tSubledger.Active = 1))) LEFT JOIN tSystem ON ((SID2.SystemID = tSystem.ID) AND (tSystem.Active = 1))) LEFT JOIN tBatchType ON ((tSystem.BatchTypeID = tBatchType.ID) AND (tBatchType.Active = 1))) LEFT JOIN tValidAccountNumber ON ((tBatchType.ID = tValidAccountNumber.BatchTypeID) AND (tValidAccountNumber.Active = 1))) LEFT JOIN tApplication ON SID2.ApplicationID = tApplication.ID LEFT JOIN tServiceKPI ON SID2.ServiceKpiID = tServiceKPI.ID LEFT JOIN tServiceMnemonic ON ((SID2.ServiceMnemonicID = tServiceMnemonic.ID) AND (tServiceMnemonic.Active = 1)) ) AS SD WHERE ServiceID LIKE '02%' AND Active = 1 ORDER BY ServiceID