Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data not getting grouped together - PLS HELP!

Author  Topic 

jimdarter
Starting Member

14 Posts

Posted - 2010-06-10 : 13:03:16
Dear All,

I am running a query that gives me a result which is not grouped the way I want. Here is the query:

SELECT SUM(c.[Duration]) as [Duration],CAST(CAST(SUM(c.[Duration]) As float)/60 as decimal(18,2)) As [Minutes], c.ocn
FROM [CDR_Billing_Sonus_' + CONVERT(varchar(10), @date, 120) + '].[dbo].[cdr_main] as c

WHERE c.[ocn]IN (''G021'',
''IUTC'',
''129F'') AND c.[calltype]=''O''
GROUP BY c.ocn


The result is not getting grouped by ocn?

Sachin.Nand

2937 Posts

Posted - 2010-06-10 : 13:16:18
Are you getting multiple Minute values for each ocn?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

jimdarter
Starting Member

14 Posts

Posted - 2010-06-10 : 13:23:33
quote:
Originally posted by Idera

Are you getting multiple Minute values for each ocn?



Yes that is correct, the result shows multiple minutes per ocn, this query is a part of a larger query, which runs through individual tables for one whole month (30 tables) and sums minutes for each ocn for that particular month but probably the query is working in a way where its doing it for every single day and not summing the minutes for the complete month per ocn?

Thanks for your reply.
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-06-10 : 13:38:35
You need to show some sample data & your desired output.


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page
   

- Advertisement -