所以我在select语句中有两个显示此信息的视图:
--------------------------------------------------------------
| branchID | branchName | staffNo | Full Name | salary | ... |
--------------------------------------------------------------
| .... |
--------------------------------------------------------------
这是我的问题:
SELECT *
FROM EmployeesAndSalaryByBranch E, CustomersByBranch C
WHERE E.branchID <> 'Headquarters';
现在,我不想从查询结果中删除branchId
和branchName
列。一种方法是创建临时表并删除列,但这非常效率低。
谢谢!
答案 0 :(得分:2)
只需从select
声明中排除列:
这个concatenate
名字和姓氏之间没有空格:
SELECT staffNo, CONCAT(firstName, lastName) AS [Full Name], salary
FROM EmployeesAndSalaryByBranch E, CustomersByBranch C
WHERE E.branchID <> 'Headquarters';
这包括名字和姓氏之间的空格:
SELECT staffNo, CONCAT(firstName, ' ', lastName) AS [Full Name], salary
FROM EmployeesAndSalaryByBranch E, CustomersByBranch C
WHERE E.branchID <> 'Headquarters';