TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
houssem ayari
NA
20
1k
The subquery return multiple values.
Apr 26 2021 8:12 AM
Hello I am working on SQL query that updates my container automatically but I got this error that makes my SQL query don't work :
' The subquery return multiple values. This is not allowed when the subquery follows =,! =, <, <=,>,> = Or when it is used as an expression. '
This is my full query and the part that makes the problem is under :
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()))
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 )
I need to get all the values and insert them in my table.
Please can someone help me
Reply
Answers (
1
)
Data synchronization from one sql server to another sql server
How to fetch records which stored in last 5 minutes in sql server