Subject group by and where
Author Virna Constantin
Hey,
why command "group by" and "where" do not work together?
Example:
CREATE TABLE TEST1
>(
>  COD char(1),
>  SUMA smallint
>);

INSERT INTO TEST1 (COD, SUMA) VALUES ('A', '3');
>INSERT INTO TEST1 (COD, SUMA) VALUES ('B', '3');
>INSERT INTO TEST1 (COD, SUMA) VALUES ('B', '7');
>INSERT INTO TEST1 (COD, SUMA) VALUES ('A', '4');
>INSERT INTO TEST1 (COD, SUMA) VALUES ('C', '5');
>INSERT INTO TEST1 (COD, SUMA) VALUES ('D', '6');



this work
SELECT COD, sum(SUMA) as suma
>FROM (select cod,suma from TEST1 where cod<'C')
>group by cod ;


this do not work
SELECT COD, sum(SUMA) as suma
>FROM TEST1
>group by cod 
>where cod<'C';



Thanks in advance.

[Non-text portions of this message have been removed]