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
 SUM per DATE and Average? Help

Author  Topic 

Chloe_19
Starting Member

44 Posts

Posted - 2012-04-09 : 21:41:02
I am trying to:
SUM up the UNITS per DATE and then average the numbers.
Example below:

ID	UNIT	DATE	   YILED PER DATE
9876 SIB 1/01/2011
9876 JIB 1/01/2011 2
9876 LOP 31/01/2011 1
9876 DOP 2/02/2009
9876 POP 2/02/2009
9876 BIL 2/02/2009 3

AVERAGE >> 2


So end result would look like this:


ID AVERAGE
9876 2

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-09 : 22:51:23
AVG([YILED PER DATE])


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Chloe_19
Starting Member

44 Posts

Posted - 2012-04-09 : 23:20:34
I am aware of the AVG
Its the yield statement that gives me problems.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-10 : 00:05:14
can you show us the query ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Chloe_19
Starting Member

44 Posts

Posted - 2012-04-10 : 00:16:02
Sorry dont have it.
Just the detailed above.
Go to Top of Page

Chloe_19
Starting Member

44 Posts

Posted - 2012-04-10 : 00:16:07
Sorry dont have it.
Just the detailed above.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-10 : 00:26:31
then post your table schema with the sample data and the required result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Chloe_19
Starting Member

44 Posts

Posted - 2012-04-10 : 02:35:52
Never mind khtan.
Got it.
Thanks for the help.
Go to Top of Page
   

- Advertisement -