我有四个表,我需要从一个具有 where 条件的表中获取数据,并且输出包含来自三个不同表的 ID,使用这些 ID 需要获取它们的名称。
Company:
CompanyID - PK
CompanyName
CompanyDescription
Users:
UserID - PK
FirstName
LastName
Email
TaskDetails:
TaskID - PK
CompanyID - FK of Company.CompanyID
TaskStatus:
TaskStatusID - PK
TaskID - FK of TaskDetails.TaskID
Status
Details
CreatedBy - FK of Users.UserID
UpdatedBy - FK of Users.UserID
CreatedAt
UpdatedAt
需要一个查询来返回如下内容:
CompanyName,Email,Status,Details,CreatedAt,UpdatedAt with where condition on TaskStatus table TaskStatus.UpdatedBy!=1 and TaskStatus.UpdatedAt>'2013-08-01' and TaskStatus.status='COMPLETED'