I write query am not find out the error in this query, please help me..
我写的查询没有找到这个查询中的错误,请帮助我。
I am getting error:
我得到错误:
Error Message.Incorrect Syntax near'.'. error
错误消息。附近的错误语法'。'。错误
for my query:
我的查询:
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
4 个解决方案
#1
3
Comma needed between FirstName
and dbo.EP_UserDetails.
Or if you are trying to concatenate the two for full name you need to do that. Can't just have a space. I believe in SQLServer it's +
sign.
FirstName和dbo.EP_UserDetails之间需要逗号。或者如果你想把两个名字连起来,你需要这样做。不能只是有空间。我相信SQLServer是+号的。
#2
1
Add comma between dbo.EP_UserDetails.FirstName,dbo.EP_UserDetails.LastName
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
#3
0
As Leeish told comma is missing that's it is generating problem, but my personal suggestion in this case please create table alias and use it as below:
正如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
#4
0
The problem in your question is you are missing + sign to contact two field Firstname and Lastname.
您的问题是您缺少+ sign来联系两个字段名和姓。
Try this.
试试这个。
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
Regards AB Vyas
问候AB Vyas以及
#1
3
Comma needed between FirstName
and dbo.EP_UserDetails.
Or if you are trying to concatenate the two for full name you need to do that. Can't just have a space. I believe in SQLServer it's +
sign.
FirstName和dbo.EP_UserDetails之间需要逗号。或者如果你想把两个名字连起来,你需要这样做。不能只是有空间。我相信SQLServer是+号的。
#2
1
Add comma between dbo.EP_UserDetails.FirstName,dbo.EP_UserDetails.LastName
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
#3
0
As Leeish told comma is missing that's it is generating problem, but my personal suggestion in this case please create table alias and use it as below:
正如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
#4
0
The problem in your question is you are missing + sign to contact two field Firstname and Lastname.
您的问题是您缺少+ sign来联系两个字段名和姓。
Try this.
试试这个。
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
Regards AB Vyas
问候AB Vyas以及