Subject | sum(field) with subselect |
---|---|
Author | Roland Turcan |
Post date | 2002-09-07T12:22:12Z |
Hello ib-support@yahoogroups.com!
Example:
I need sum two rows in table, but those rows is returned from
subselect.
select sum(Field) from Table where ID in (select first 2 ID from Table);
This statement tot up all rows from Table and not only two rows that
were returned from subselect.
This statement return two rows with 63, 64 value
select first 2 jedin from nastavenia;
And this tot up, and result is OK.
select sum(jedin) from nastavenia where jedin in (63,64);
Why does't work.
--
Best regards, TRoland
http://www.rotursoft.sk
Example:
I need sum two rows in table, but those rows is returned from
subselect.
select sum(Field) from Table where ID in (select first 2 ID from Table);
This statement tot up all rows from Table and not only two rows that
were returned from subselect.
This statement return two rows with 63, 64 value
select first 2 jedin from nastavenia;
And this tot up, and result is OK.
select sum(jedin) from nastavenia where jedin in (63,64);
Why does't work.
--
Best regards, TRoland
http://www.rotursoft.sk