|
-
March 4th, 2011, 03:09 PM
#1
[RESOLVED] 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!
-
March 5th, 2011, 08:41 AM
#2
Re: SQL syntax error
Code:
update tbl_M_MasterLogs set rptprobtype =
(Select [Problem Type]from tbl_rpt_MasterData
where tbl_M_MasterLogs.CaseNo = tbl_rpt_MasterData.CaseNo)
I was criticised by one of my peers recently because I performed 6 Update Statements SEPARATELY instead of putting all the updates in ONE Statement
My answer was - "If an update fails then I will know exactly where the error lies"
This is your answer
While it is tricky and cute to string a couple of SQL Statements into one big one, you now are in the position of having to ask why it doesnt work
Life must go on, so do the boring thing and split up your statement and find where the errror really lies
Code:
1) Select [Problem Type] from tbl_rpt_MasterData
where tbl_M_MasterLogs.CaseNo = tbl_rpt_MasterData.CaseNo
2) update tbl_M_MasterLogs set rptprobtype = [Problem Type]
You are now dealing with beginners level SQL - why not stick to it in future - it will save you so much confusion and heartache
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|