gpt4 book ai didi

sql - SQL逗号错误

转载 作者:行者123 更新时间:2023-12-03 08:17:06 25 4
gpt4 key购买 nike

我正在为学校分配SQL作业,这是我正在查询的内容。

SELECT 
Regions.RegionName, Countries.CountryName,
(Employees.LastName + ', ' + Employees.FirstName) AS EmployeeName,
(EmployeeTitles.Title + ' ' + CAST (Employees.Level AS VARCHAR),
Employees.Salary
FROM
Regions,
Countries,
Employees,
EmployeeTitles
WHERE
Regions.RegionID = Countries.RegionID AND
Countries.CountryID = Employees.CountryID AND
Employees.TitleID = EMployeeTitles.TitleID
ORDER BY
RegionName,
CountryName,
LastName,
Title,
Salary;

给我错误的逗号在“Cast(Employee.Level AS VARCHAR)”之后,并给我一个错误,说“','附近的语法不正确-”

谢谢。

最佳答案

在逗号之前,您已经错过了右括号。

(EmployeeTitles.Title + ' ' + CAST (Employees.Level AS VARCHAR), 

应该成为
(EmployeeTitles.Title + ' ' + CAST (Employees.Level AS VARCHAR)), 

关于sql - SQL逗号错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50413435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com