You are here: Re: Group SQL Select Statement « MsSQL Server « IT news, forums, messages
Re: Group SQL Select Statement

Posted by MC on 03/23/07 18:22

Something like this=

Select
SCDMASTER.SCTY_CLASS_CODE,
sum(CUSTODY_BALANCE.OPENING_BALANCE +
CUSTODY_BALANCE.DEPOSIT_AMOUNT -CUSTODY_BALANCE.WITHDRAWAL_AMOUNT)

from
PMCAPSHIST.CUSTODY_BALANCE CUSTODY_BALANCE,
CAPSREPORT.SCDMASTER SCDMASTER
where
CUSTODY_BALANCE.ASSET_ID = SCDMASTER.CUSIP_ID AND
((CUSTODY_BALANCE.APPLICATIONCYCLEDATE={ts '2007-03-21 00:00:00'}) AND
(SCDMASTER.SCTY_CLASS_CODE Not In
('BILL','NOTE','BOND','CD','BD','CB','TINT','TPRN','CA','YD')))
group by
SCDMASTER.SCTY_CLASS_CODE



MC

"Andreas" <andreas.strzodka@ny.frb.org> wrote in message
news:1174673610.080198.22590@y66g2000hsf.googlegroups.com...
> Hi,
>
> I am bloody amateure and I was wondering if someone could help me edit
> the statement below so it groups the field SCDMASTER.SCTY_CLASS_CODE
> and creates one field called "total balance" equalling
> CUSTODY_BALANCE.OPENING_BALANCE + CUSTODY_BALANCE.DEPOSIT_AMOUNT -
> CUSTODY_BALANCE.WITHDRAWAL_AMOUNT
>
> SELECT
> CUSTODY_BALANCE.APPLICATIONCYCLEDATE,
> CUSTODY_BALANCE.ASSET_ID,
> SCDMASTER.SCTY_CLASS_CODE,
> CUSTODY_BALANCE.OPENING_BALANCE,
> CUSTODY_BALANCE.DEPOSIT_AMOUNT,
> CUSTODY_BALANCE.WITHDRAWAL_AMOUNT
> FROM
> FPMCAPSHIST.CUSTODY_BALANCE CUSTODY_BALANCE,
> CAPSREPORT.SCDMASTER SCDMASTER
> WHERE
> CUSTODY_BALANCE.ASSET_ID = SCDMASTER.CUSIP_ID AND
> ((CUSTODY_BALANCE.APPLICATIONCYCLEDATE={ts '2007-03-21 00:00:00'}) AND
> (SCDMASTER.SCTY_CLASS_CODE Not In
> ('BILL','NOTE','BOND','CD','BD','CB','TINT','TPRN','CA','YD')))
>
> Thanks,
>
> Andreas
>

 

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

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