Hi Friends,
I am Back with a possible Problem, and hope you can help me to get a better Result.
I have a Table with some Information (how obvious
)
The Relevant Data is this
Table: ShareData
Service --> Name of a Queue
Intervall --> Time Intervall like 8,9,10,11,12....22
Sprache --> Language like DE,FR,IT,EN
Partner --> Text like ParnerA,PartnerB...
Offered --> Amount of Calls
I want to build a Query now that gives me the Share that each Partner had for a Service,Intervall and Language based on all the data in the ShareData Table
So what i did is build a Query that sums all the data by Partner and a Subquery that gets the Same information without the Partner.
The Query gives me the Result that i want but it is horribly Slow.
now the Questions is if that is to be expected or is my query just horribly bad Designed.
Thanks for Feedback
I am Back with a possible Problem, and hope you can help me to get a better Result.
I have a Table with some Information (how obvious
The Relevant Data is this
Table: ShareData
Service --> Name of a Queue
Intervall --> Time Intervall like 8,9,10,11,12....22
Sprache --> Language like DE,FR,IT,EN
Partner --> Text like ParnerA,PartnerB...
Offered --> Amount of Calls
I want to build a Query now that gives me the Share that each Partner had for a Service,Intervall and Language based on all the data in the ShareData Table
So what i did is build a Query that sums all the data by Partner and a Subquery that gets the Same information without the Partner.
The Query gives me the Result that i want but it is horribly Slow.
now the Questions is if that is to be expected or is my query just horribly bad Designed.
Thanks for Feedback
Code:
SELECT SD1.Service, SD1.Intervall, SD1.Sprache, SD1.Partner, Sum(SD1.Offered) /
(SELECT SUM(SD2.Offered) FROM ShareData as SD2
WHERE SD1.Service = SD2.Service AND SD1.Intervall=SD2.Intervall AND SD1.Sprache= SD2.Sprache) AS Share
FROM ShareData AS SD1
GROUP BY SD1.Service, SD1.Intervall, SD1.Sprache, SD1.Partner;