Subject | Re: [firebird-support] SubSelect Question |
---|---|
Author | Helen Borrie |
Post date | 2003-11-10T23:41:17Z |
At 10:57 PM 10/11/2003 +0000, you wrote:
sub-select into a different table:
select
m.x. m.y, ...
(select avg(a.volume) from that_table a
where a.volume >=1 and a.some_key = m.some_key) as posvalue,
(select avg(b.volume) from that_table b
where b.volume < 1 and b.some_key = m.some_key) as negvalue,
m.z
from main_table m
where....
heLen
>Hi,Since your Subject says "SubSelect Question" I assume you want to
>
>maybe someone can help me with this:
>I have a table with a column that holds negative and positive volume
>numbers.
>e.g:
>100
>-250
>300
>50
>you get the idea ;)
>
>Is there a way to select in one SELECT statement an AVG for all
>negative volumes and all positive volumes?
sub-select into a different table:
select
m.x. m.y, ...
(select avg(a.volume) from that_table a
where a.volume >=1 and a.some_key = m.some_key) as posvalue,
(select avg(b.volume) from that_table b
where b.volume < 1 and b.some_key = m.some_key) as negvalue,
m.z
from main_table m
where....
heLen