/*Displays employees’ last names and the Job Title and GROUP Job Title*/
USE [EXAMPLEDB]
SELECT empLName
FROM tblEmployee
ここで混乱します。従業員の姓と従業員の役職を含む 2 つの異なるテーブルを使用してこれを行うにはどうすればよいでしょうか。
SELECT jobTitle
FROM tblJobTitle
GROUP BY jobTitle
これらは私のテーブルです:
--This Code Creates the Job Title Table--
CREATE TABLE [SHATTKudlerFineFoods].dbo.tblJobTitle
(
jobJobID varchar (4) CONSTRAINT PK_jobJobID PRIMARY KEY Not Null,
jobJobClass varchar (60) Not Null,
jobTitle varchar (60) Not Null,
jobDescription varchar (300) Not Null,
jobStatus varchar (11) Not Null
)
--This Code Creates the Employee Table--
CREATE TABLE [SHATTKudlerFineFoods].dbo.tblEmployee
(
empEmpID varchar (3) CONSTRAINT PK_empEmployeeID PRIMARY KEY Not Null,
empLName varchar (20) Not Null,
empFName varchar (15) Not Null,
empAddress varchar (30) Not Null,
empCity varchar (20) Not Null,
empState varchar (2) Not Null,
empZIPCode varchar (5) Not Null,
empAreaCode varchar (3) Not Null,
empPhoneNo varchar (8) Not Null,
empGender varchar (1) Not Null,
empDOB smalldatetime Not Null,
empAge Tinyint Not Null,
empHireDate smalldatetime Not Null,
empNoOfExempt Tinyint Not Null,
empMaritalStatus varchar (3) Not Null,
empSalary money Not Null,
empStoreID varchar (4) CONSTRAINT FK_strStoreID FOREIGN KEY REFERENCES
tblStores(strStoreID) Not Null,
empJobID varchar (4) CONSTRAINT FK_jobJobID FOREIGN KEY REFERENCES
tblJobTitle(jobJobID) Not Null
)