我写的查询没有找到这个查询中的错误,请帮帮我..
我收到错误:
错误Message.Incorrect语法在'。'附近。错误
我的查询:
SELECT
dbo.EP_UserDetails.UserID, dbo.EP_UserDetails.EmpID,
dbo.EP_UserDetails.FirstName dbo.EP_UserDetails.LastName AS Name,
dbo.EP_LeaveManagement.LeaveType, dbo.EP_LeaveManagement.NoOfDays,
dbo.EP_LeaveManagement.LeaveAppliedFromDate,
dbo.EP_LeaveManagement.LeaveAppliedToDate, dbo.EP_User.MangerUserID
FROM
dbo.EP_User
INNER JOIN
dbo.EP_UserDetails ON dbo.EP_User.UserID = dbo.EP_UserDetails.UserID
INNER JOIN
dbo.EP_LeaveManagement ON dbo.EP_User.UserID = dbo.EP_LeaveManagement.UserID
答案 0 :(得分:3)
FirstName
和dbo.EP_UserDetails.
之间需要使用逗号。或者如果您尝试将两者连接为全名,则需要执行此操作。不能只是有空间。我相信SQLServer是+
符号。
答案 1 :(得分:1)
在dbo.EP_UserDetails.FirstName,dbo.EP_UserDetails.LastName
之间添加逗号SELECT dbo.EP_UserDetails.UserID, dbo.EP_UserDetails.EmpID, dbo.EP_UserDetails.FirstName,dbo.EP_UserDetails.LastName AS Name,
dbo.EP_LeaveManagement.LeaveType, dbo.EP_LeaveManagement.NoOfDays, dbo.EP_LeaveManagement.LeaveAppliedFromDate,
dbo.EP_LeaveManagement.LeaveAppliedToDate, dbo.EP_User.MangerUserID
答案 2 :(得分:0)
由于Leeish告诉逗号错过了它会产生问题,但在这种情况下我的个人建议请创建表别名并使用如下:
SELECT dbo.EUD.UserID, dbo.EUD.EmpID, dbo.EUD.FirstName, dbo.EUD.LastName AS Name,
dbo.ELM.LeaveType, dbo.ELM.NoOfDays, dbo.ELM.LeaveAppliedFromDate,
dbo.ELM.LeaveAppliedToDate, dbo.EU.MangerUserID
FROM dbo.EP_User EU INNER JOIN
dbo.EP_UserDetails EUD ON dbo.EU.UserID = dbo.EUD.UserID INNER JOIN
dbo.ELM ELM ON dbo.EU.UserID = dbo.ELM.UserID
答案 3 :(得分:0)
您的问题中的问题是您缺少+标记以联系两个字段名字和姓氏。
试试这个。
SELECT dbo.EP_UserDetails.UserID, dbo.EP_UserDetails.EmpID, dbo.EP_UserDetails.FirstName + dbo.EP_UserDetails.LastName AS Name,
dbo.EP_LeaveManagement.LeaveType, dbo.EP_LeaveManagement.NoOfDays, dbo.EP_LeaveManagement.LeaveAppliedFromDate,
dbo.EP_LeaveManagement.LeaveAppliedToDate, dbo.EP_User.MangerUserID
FROM dbo.EP_User INNER JOIN
dbo.EP_UserDetails ON dbo.EP_User.UserID = dbo.EP_UserDetails.UserID INNER JOIN
dbo.EP_LeaveManagement ON dbo.EP_User.UserID = dbo.EP_LeaveManagement.UserID
此致 AB Vyas