Hi i have querry statement in my ETL to insert data in my table but i got this error :
"The subquery return multiple values. This is not allowed when the subquery follows =,! =, <, <=,>,> = Or when it is used as an expression."
Please help !!
This is the querry statement :
INSERT INTO [CRM_GAT].[dbo].[Table_Audit_Sinistres]([Libelle_Etape],[time],[Count_Input],[NumSinistre],[Count_Output])
VALUES ('FIN_TR_Sinistre',GEtDATE()
,(SELECT COUNT(*)FROM [CRM_GAT].[dbo].[Sinistre] WHERE ([CodeValidation] is null or [CodeValidation]=0) and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE()),
(SELECT [NumSinistre]FROM [CRM_GAT].[dbo].[Sinistre] where [NumContrat] in(select [NumContrat] from [CRM_GAT].[dbo].[Contrats] where [CodeProduit]!=7940 and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE())
and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE() and ([CodeValidation] is null or [CodeValidation]=0 ))
,(SELECT COUNT(*) FROM [CRMGAT].[dbo].[Sinistre] WHERE [CtrCodeSource]=1 and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE()))
What I have tried:
This is querry causing problems :
SELECT [NumSinistre]FROM [CRM_GAT].[dbo].[Sinistre] where [NumContrat] in(select [NumContrat] from [CRM_GAT].[dbo].[Contrats] where [CodeProduit]!=7940 and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE())
and [DateOperation] between DATEADD(day,-10, GETDATE()) and GETDATE() and ([CodeValidation] is null or [CodeValidation]=0)