Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 problem in select statement

Author  Topic 

new_developer
Starting Member

18 Posts

Posted - 2012-03-25 : 06:56:26
I have problem with this statement
select ([NotID],[NotDate],[DeptID],[ExtNum],[OfficeNum],[FloorNum],[SuiteID],[SectionID],[MachineTypeID]
,[MachineSerial],[ProblemDesc],[TimeToFinishIDD],[FinishDate],[FinishTime],[EmpCivilID],[TimeToFinishH]
,[EmpPermision],[Status_order],[Emp_name],[User_name],[Emp_ID],[ResEmpName]) from [Not],[Res] where status=0 and Res.UserID=Not.Emp_ID

error message is Incorrect syntax near ','.
any one can help me

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-25 : 08:04:31
Remove the brackets around the select list. Also, Not is a reserved keyword, so escape it with square brackets.
SELECT 
[NotID],
[NotDate],
[DeptID],
[ExtNum],
[OfficeNum],
[FloorNum],
[SuiteID],
[SectionID],
[MachineTypeID],
[MachineSerial],
[ProblemDesc],
[TimeToFinishIDD],
[FinishDate],
[FinishTime],
[EmpCivilID],
[TimeToFinishH],
[EmpPermision],
[Status_order],
[Emp_name],
[User_name],
[Emp_ID],
[ResEmpName]

FROM [Not],
[Res]
WHERE STATUS = 0
AND Res.UserID = [Not].Emp_ID
Go to Top of Page
   

- Advertisement -