I am trying to select multiple variables from a subquery in order to use later. Here’s my code:
DECLARE @MarketplaceName VARCHAR(50),
@ProductFieldID INT,
@FromValue VARCHAR(255) = (
SELECT mcvm.MarketplaceName,
mcvm.ProductFieldID,
mcvm.FromValue
FROM [Meta].[MarketplaceCategoryValueMapping] AS mcvm
WHERE mcvm.MarketplaceCategoryValueMappingID = @MapID
)
I’m getting the following error message:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
I’m trying to map @MarketplaceName from mcvm.MarketplaceName, etc.
What I would like is to not have to write multiple SELECT statements for each of these variables.
Are you trying to do this?