我用Google搜索并搜索了这个地方,但不是我能找到的答案,因为其他人的情况有所不同。
USE TestDatabase
Select Firstname,Lastname,Salary From Employee as E
Join JobTitle as J
on E.JobTitleID = J.JobTitleID
WHERE Salary
BETWEEN $25000.00 AND $50000.00
这有效,但我试图显示JobTitle表中的两列,我不知道要搜索哪些字词或谷歌,也不能找到一个简单的答案。任何人都可以帮助一些人,但我很困惑。我正在使用server 2008 t-sql for school
答案 0 :(得分:3)
您可以使用JobTitle
表{/ 1}}的别名来选择要选择的任何额外列
J
答案 1 :(得分:1)
使用别名设置您在该字段中使用的表格。
Select
E.Firstname,E.Lastname,E.Salary,
j.JobTitle, j.Otherfieldyouwanttoselect
From Employee as E Join JobTitle as J on E.JobTitleID = J.JobTitleID
WHERE
Salary BETWEEN $25000.00 AND $50000.00
答案 2 :(得分:0)
Select E.Firstname, E.Lastname, E.Salary, J.Column1, J.Column2
From Employee as E
Join JobTitle as J
on E.JobTitleID = J.JobTitleID
WHERE E.Salary BETWEEN $25000.00 AND $50000.00
答案 3 :(得分:0)
USE TestDatabase
Select Firstname,Lastname,Salary,J.YourcolumnfromJobTitle From Employee as E
Join JobTitle as J
on E.JobTitleID = J.JobTitleID
WHERE Salary
BETWEEN $25000.00 AND $50000.00
答案 4 :(得分:0)
你应该为这两个表使用别名:
USE TestDatabase
Select E.Firstname,E.Lastname,E.Salary,J.Column1,j.Column2 From Employee as E
Join JobTitle as J
on E.JobTitleID = J.JobTitleID
WHERE E.Salary
BETWEEN $25000.00 AND $50000.00