Hi All,
I have been stumped by this top 10 query. I have a table of phone calls. The critical fields are ;
Handset (the mobile number being used to make the call)
DialledNumber
TotalSeconds (number of seconds the call lasted).
I want to write a query which will give me, for each handset, the top 5 dialled numbers in terms of total seconds.
I group the table first to get Handset,DialledNumber,SUM(TotalSeconds). Call this QUERY1
Then I do a second query on QUERY 1 where the criteria on SumOFTotalSeconds is as follows ;
But this gives me all calls to the overall top 10 dialled numbers - NOT the top 10 per handset.
Can anyone help me with this ?
Thanks,
StepOne
I have been stumped by this top 10 query. I have a table of phone calls. The critical fields are ;
Handset (the mobile number being used to make the call)
DialledNumber
TotalSeconds (number of seconds the call lasted).
I want to write a query which will give me, for each handset, the top 5 dialled numbers in terms of total seconds.
I group the table first to get Handset,DialledNumber,SUM(TotalSeconds). Call this QUERY1
Then I do a second query on QUERY 1 where the criteria on SumOFTotalSeconds is as follows ;
Code:
In (SELECT TOP 10 [DialledNumber]
FROM tblMasterCalls WHERE [tblMasterCalls].[HandsetNumber] = [HandsetNumber]
GROUP BY tblMasterCalls.CleanDialledNumber
ORDER BY Sum(tblMasterCalls.TotalSeconds) DESC;)
But this gives me all calls to the overall top 10 dialled numbers - NOT the top 10 per handset.
Can anyone help me with this ?
Thanks,
StepOne