Using Alias when joining 2 or more tables

Avatar
  • updated
  • Completed

Hi,

Is there a way to add alias when joining 2 or more tables?

I am trying to make it look from this:

SELECT
  AdventureWorks2012.HumanResources.Department.GroupName AS [Group Name],
  AdventureWorks2012.HumanResources.EmployeeDepartmentHistory.EndDate AS [End Date],
  AdventureWorks2012.HumanResources.Employee.LoginID,
  AdventureWorks2012.HumanResources.Employee.JobTitle
FROM
  AdventureWorks2012.HumanResources.Department
  INNER JOIN AdventureWorks2012.HumanResources.EmployeeDepartmentHistory ON
    AdventureWorks2012.HumanResources.EmployeeDepartmentHistory.DepartmentID =
    AdventureWorks2012.HumanResources.Department.DepartmentID
  INNER JOIN AdventureWorks2012.HumanResources.Employee ON
    AdventureWorks2012.HumanResources.EmployeeDepartmentHistory.BusinessEntityID =
    AdventureWorks2012.HumanResources.Employee.BusinessEntityID

 

To something like this using FlySpeed Query.

SELECT
  d.GroupName AS [Group Name],
  h.EndDate AS [End Date],
  E.LoginID,
  E.JobTitle
FROM
  AdventureWorks2012.HumanResources.Department d
  INNER JOIN AdventureWorks2012.HumanResources.EmployeeDepartmentHistory h ON h.DepartmentID = d.DepartmentID
  INNER JOIN AdventureWorks2012.HumanResources.Employee E ON h.BusinessEntityID = E.BusinessEntityID

 

Regards,

Luis

Avatar
Anonymous

Hello, Luis.

 

Yes, this is possible. Doubleclick on the datasource header or right-click on it and select the Properties menu item:

Enter the alias for a datasource:

 

Avatar
LEM

Sergey,

Thank you for the solution and support.