I want to run this query
INSERT INTO [tblPollLogs]
([lastModified]
,[ip]
,[a1]
,[a2]
)
VALUES
(getdate()
,'aaa'
,(select top 1 header from [tblPollAnswer] where [pollAnswerId] = @param1)
,(select top 1 header from [tblPollAnswer] where [pollAnswerId] = @param2)
)
But I get the error
Subqueries are not allowed in this context. Only scalar expressions are allowed.
can i run this query in one query or i need get the values before running this query
thanks
top 1with noorder by? If there is more than one matching row it is undeterministic what will be inserted and if there isn't more than one matching row you don't need thetop 1.