-
Update table
I have 2 tables and update data from one table to another. need to update one or two filed only.
inout.Execute "UPDATE Staff_test " _
& "SET name = (select name from staff) where empno = '102' ;"
while excute received the following error:
Subquery returned more the 1 value. This is not permitted when the subquery follow =,!=,<, >= or when the subquery is used as an expression.
if I use like:
inout.Execute "UPDATE Staff_test " _
& "SET name = (select name from staff where staff.empno = '102' ) ;"
Then no error but it update all records not specified one.
Can someone fix pls.
Thanks
Last edited by kafsar; 12-15-2010 at 06:20 AM.
-
You need to include the WHERE clause on both the main query and the subquery:
UPDATE Staff_test
SET name = (SELECT name FROM staff WHERE staff.empno = '102' )
WHERE empno = '102';
Phil Weber
http://www.philweber.com
Please post questions to the forums, where others may benefit.
I do not offer free assistance by e-mail. Thank you!
Similar Threads
-
By software_develo in forum Database
Replies: 10
Last Post: 02-21-2012, 12:02 PM
-
By charligov in forum VB Classic
Replies: 2
Last Post: 01-22-2007, 12:00 PM
-
By novi in forum Database
Replies: 2
Last Post: 03-09-2005, 12:56 PM
-
By JeePee in forum Database
Replies: 7
Last Post: 02-18-2005, 02:42 PM
-
By Marian Stirbescu in forum VB Classic
Replies: 0
Last Post: 09-22-2001, 04:51 AM
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
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|