LEFT JOIN 连接多表的例子
SELECT a.IP as IP, a.hostName as hostname, b.SystemTypeId as SystemTypeId,b.os as os,
Mac,a.UserId,c.UserName,d.DeptName, RoomNo, Number, LAddress,a.other FROM
B_EndpInfo a LEFT JOIN B_SystemType b ON a.SystemTypeId = b.SystemTypeId
LEFT JOIN B_Users c ON a.UserId = c.UserId
LEFT JOIN B_DeptInfo d ON c.DeptNo = d.DeptNo
ORDER BY a.ip