Re: sql question
Posted in 1999
Topics: General Discussion
From: "M.J. Holley" <datashark@fastlane.net>
>
>I have table1 with fields acctnum, amt1, ident
>
>I need to build either a table or a view which contains rows of
>acctnum, sum(amt1) where ident = "C", sum(amt1) where ident="R" for each
>acctnum in table1.
select acctnum, sum(amt1) csum
from table1
where ident = "C"
into temp t1;
select acctnum, sum(amt1) rsum
from table1
where ident = "R"
into temp t2;
select table1.acctnum, csum, rsum
from table1, outer t1, outer t2
where table1.acctnum = t1.acctnum
and table1.acctnum = t2.acctnum
?
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
Obnoxio The Clown <obnoxio@hotmail.com> schrieb in im Newsbeitrag: 832h1g$qvf$1@news.xmission.com...
>
> From: "M.J. Holley" <datashark@fastlane.net>
> >
> >I have table1 with fields acctnum, amt1, ident
> >
> >I need to build either a table or a view which contains rows of
> >acctnum, sum(amt1) where ident = "C", sum(amt1) where ident="R" for each
> >acctnum in table1.
>
> select acctnum, sum(amt1) csum
> from table1
> where ident = "C"
> into temp t1;>
> select acctnum, sum(amt1) rsum
> from table1
> where ident = "R"
> into temp t2;>
> select table1.acctnum, csum, rsum
> from table1, outer t1, outer t2
> where table1.acctnum = t1.acctnum
> and table1.acctnum = t2.acctnum>
> ?
Sorry Clown, don´t work!