I dont now of the API call but I have the queies:
SELECT
Calendarkey
,[mediaType]
,[queueId]
, UserID
,[Direction]
,[metric]
,[Value] -- Via Unpivot Clausen fyldes den her kolonne med metric identifierne (Max,Min,Count,Sum)
,[Values] -- Via Unpivot Clausen fyldes dne her kolonne med de respektive værdier for (Max,Min,Count,Sum)
FROM (
SELECT *
FROM (
SELECT
[Calendarkey] = CONVERT(date, startTime)
,cqa.[mediaType]
,cqa.[queueId]
, UserID
,cqa.[metric]
,cqa.[Direction]
,cqa.[count]
,cqa.[sum]
FROM [sourceGenesysAPI].[ConversationQueryAggregates_history] AS cqa
) AS sub
UNPIVOT( [Values]
FOR [Value] IN ( [sum], [count] )
) AS upvt
) AS sub
where queueId is not null
)
,
SELECT
Calendarkey
,[mediaType]
,[queueId]
, UserID
,[Direction]
,[metric]
,[Value] -- Via Unpivot Clausen fyldes den her kolonne med metric identifierne (Max,Min,Count,Sum)
,[Values] -- Via Unpivot Clausen fyldes dne her kolonne med de respektive værdier for (Max,Min,Count,Sum)
FROM (
SELECT *
FROM (
SELECT
[Calendarkey] = CONVERT(date, startTime)
,cqa.[mediaType]
,cqa.[queueId]
, UserID
,cqa.[metric]
,cqa.[Direction]
,cqa.[count]
,cqa.[sum]
FROM [sourceGenesysAPI].[ConversationQueryAggregates_history] AS cqa
) AS sub
UNPIVOT( [Values]
FOR [Value] IN ( [sum], [count] )
) AS upvt
) AS sub
where queueId is not null
)
Where the only difference is that we have included conversatoinId in one table and not in the other?