What am I doing wrong in the code to receive this error?
i get an error saying this:
Server: 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.
In the tbl hbc_zImport owner_state data type is a varchar and the state's are abbr. where in hbc_contact state_id data type is int. I have a tbl called hbc_state that contains name, abr, and fips code.
Here's the code I've written, the select statments works fine alone, but with the update it'll give me an error.
update HBC_Contact
set state_id =
(SELECT HBC_STATE.ID
FROM HBC_STATE, HBC_ZIMPORT
WHERE HBC_STATE.ABR = HBC_ZIMPORT.OWNER_STATE
AND HBC_ZIMPORT.OWNER_NAME = HBC_CONTACT.BUSINESS_NAME
)
i get an error saying this:
Server: 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.
In the tbl hbc_zImport owner_state data type is a varchar and the state's are abbr. where in hbc_contact state_id data type is int. I have a tbl called hbc_state that contains name, abr, and fips code.
Here's the code I've written, the select statments works fine alone, but with the update it'll give me an error.
update HBC_Contact
set state_id =
(SELECT HBC_STATE.ID
FROM HBC_STATE, HBC_ZIMPORT
WHERE HBC_STATE.ABR = HBC_ZIMPORT.OWNER_STATE
AND HBC_ZIMPORT.OWNER_NAME = HBC_CONTACT.BUSINESS_NAME
)