You are here: Re: SQL script - sum total issue « MsSQL Server « IT news, forums, messages
Re: SQL script - sum total issue

Posted by Erland Sommarskog on 09/10/05 00:16

Jeffrey S via SQLMonster.com (forum@SQLMonster.com) writes:
> I have this script...I would like to group the total of project_amt_1
> (July) by the project_id and the same for the 11 months and the total.

It is unclear to me what you want. If all you want is the sum per
project and no information per component and cost_element, then
you can say:

select a.project_id, SUM(a.project_amt_1) as 'July',
SUM(a.project_amt_2) as 'August'
...
from component_monetary_balance as a, project as b, component as c
...
and project_ytd_amt <> 0
GROUP BY a.project_id

If this does not answer you question, could you please clarify with
an example?


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация