1 回答

TA貢獻1780條經(jīng)驗 獲得超5個贊
您在選擇中為表創(chuàng)建別名,然后您可以使用 2 個不同的標識訪問同一個表。我對您的 select 語句中的值執(zhí)行了相同的操作(創(chuàng)建別名),以確定哪個城市是哪個城市。
SELECT Students.StudentID, Students.Name, Students.Birthday, Students.MothersName, Classes.ClassName, StudentBirthCities.Name as StudentBirthCityName, StudentCity.Name as StudentCityName,
PostalCode.PostalCode, Street.StreetName, Students.Number
FROM Students
INNER JOIN Classes ON Students.ClassID = Classes.ClassID
INNER JOIN Cities StudentBirthCities ON Students.BirthPlaceID = StudentBirthCities.CityID
INNER JOIN Cities StudentCity ON Students.CityID = StudentCity.CityID
INNER JOIN PostalCode ON Students.PostalCodeID = PostalCode.PostalCodeID
INNER JOIN Utca ON Students.StreetID = Streets.StreetID
- 1 回答
- 0 關(guān)注
- 85 瀏覽
添加回答
舉報