I have a problem with this query. I want to do the next:
The records that aren't in the same table, should be add it using the other table.
DECLARE @account INT = 8825
INSERT INTO [Fleet].[dbo].[AccountsReports] ([AccountId], [ReportId], [ReportName])
SELECT
@account AccountId,
[ReportId],
[Name]
FROM
[Fleet].[dbo].[Reports]
WHERE
ReportId IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,54)
AND ReportId NOT IN (SELECT @account AccountId, [ReportId], [Name]
FROM [Fleet].[dbo].[Reports]
WHERE ReportId IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,54)
)
This shows an exception:
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
The queries separated are working fine. Can you help me to learn what my problem is?
Thanks