select('workstation.*, department.DepartmentName, wst1.WorkstationName as LinkToName') ->join('workstation wst1', 'workstation.LinkTo=wst1.WorkstationID', 'left') ->join('department', 'department.DepartmentID=workstation.DepartmentID', 'left') ->findAll(); return $rows; } public function getWorkstation($WorkstationID) { $rows = $this->select("workstation.*, department.DepartmentName, wst1.WorkstationName as LinkToName, CASE WHEN workstation.Enable = 1 THEN 'Enabled' ELSE 'Disabled' END AS EnableText") ->join('workstation wst1', 'workstation.LinkTo=wst1.WorkstationID', 'left') ->join('department', 'department.DepartmentID=workstation.DepartmentID', 'left') ->where('workstation.WorkstationID', $WorkstationID) ->findAll(); return $rows; } }