954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

SQL syntax error

Hi everyone,
I am getting this error:

Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.


please help, I have tried to solve it on my own but still can't find the right answer..

this is the query:

[update tbl_M_MasterLogs set rptprobtype =
(Select [Problem Type]
from tbl_rpt_MasterData
where tbl_M_MasterLogs.CaseNo = tbl_rpt_MasterData.CaseNo)


Thank you very much in advance!

aplee
Light Poster
28 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Your subquery is returning multiple rows. This could be fixed with a join:

update ML
set ML.rptprobtype = MD.[Problem Type]
FROM tbl_M_MasterLogs ML
JOIN tbl_rpt_MasterData MD ON ML.CaseNo = MD.CaseNo
buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: