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
 SQL Display TOTAL per day

Author  Topic 

SQLNoob8
Starting Member

5 Posts

Posted - 2012-07-31 : 11:34:09
How do I get NUMTIME to show the TOTAL for instead of each by att?

I want that column to display TOTAL for each DAY.

Thanks,

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-31 : 11:40:39
if its sql server its just a matter of replacing NUMTIMES_ABANDON in query with

SUM(NUMTIMES_ABNADON) OVER (PARTITION BY SiteID,SITENAME,ABANDON_DATE)

but you're using Oracle so not sure on that
Also this is ms sql server forum so there are not enough Oracle experts here

you may be better of posting this in oracle forums to get oracle related help

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-07-31 : 11:51:09
ANSI complaint syntax would be

SELECT q.*,q1.NumTimes_Abandon AS Yourrequiredcount
FROM
( your current query) q
INNER JOIN
(attached below query)q1
ON q1.SiteID = q.SiteID
AND q1.SiteName = q.SiteName
AND q1.Abandon_Date = q.Abandon_Date




------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

SQLNoob8
Starting Member

5 Posts

Posted - 2012-07-31 : 11:54:50
quote:
Originally posted by visakh16

if its sql server its just a matter of replacing NUMTIMES_ABANDON in query with

SUM(NUMTIMES_ABNADON) OVER (PARTITION BY SiteID,SITENAME,ABANDON_DATE)

but you're using Oracle so not sure on that
Also this is ms sql server forum so there are not enough Oracle experts here

you may be better of posting this in oracle forums to get oracle related help

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/






Thanks alot!

It works
Go to Top of Page
   

- Advertisement -