Subject | firebird1.5 group by question |
---|---|
Author | Rich Ding |
Post date | 2003-04-30T04:22:18Z |
Hello,
I have a question ,Please help
TWO TABLES:
/****************************/
CREATE TABLE ORDERCOLOR (
ORDERID INTEGER NOT NULL,
COLORID INTEGER NOT NULL,
FIXKIND SMALLINT DEFAULT 0 NOT NULL,
SIZELEVEL VARCHAR (20),
WORKINGORDER SMALLINT) ;
ALTER TABLE ORDERCOLOR ADD PRIMARY KEY (ORDERID, COLORID, FIXKIND,
SIZELEVEL);
/****************************/
CREATE TABLE COLOR (
COLORID INTEGER NOT NULL,
COLORNO VARCHAR(20) NOT NULL,
NAME VARCHAR(40) NOT NULL,
COLORINDEX INTEGER DEFAULT 0 NOT NULL);
ALTER TABLE COLOR ADD PRIMARY KEY (COLORID);
ALTER TABLE COLOR ADD UNIQUE (COLORNO);
/****************************/
this query on firebird1.5 result a error :
Select o.ColorId,max(c.name) colorname , max(c.colorno) colorno
from OrderColor O
join color c on (o.colorid = c.colorid)
group by o.colorid
order by o.workingorder
Dynamic SQL Error.
SQL error code = -104.
invalid column reference.
firebird 1.02 no error .
this query on firebird1.5 no error
Select o.ColorId,max(c.name) colorname , max(c.colorno) colorno
from OrderColor O
join color c on (o.colorid = c.colorid)
group by o.colorid ,o.workingorder
order by o.workingorder
what's wrong?
[Non-text portions of this message have been removed]
I have a question ,Please help
TWO TABLES:
/****************************/
CREATE TABLE ORDERCOLOR (
ORDERID INTEGER NOT NULL,
COLORID INTEGER NOT NULL,
FIXKIND SMALLINT DEFAULT 0 NOT NULL,
SIZELEVEL VARCHAR (20),
WORKINGORDER SMALLINT) ;
ALTER TABLE ORDERCOLOR ADD PRIMARY KEY (ORDERID, COLORID, FIXKIND,
SIZELEVEL);
/****************************/
CREATE TABLE COLOR (
COLORID INTEGER NOT NULL,
COLORNO VARCHAR(20) NOT NULL,
NAME VARCHAR(40) NOT NULL,
COLORINDEX INTEGER DEFAULT 0 NOT NULL);
ALTER TABLE COLOR ADD PRIMARY KEY (COLORID);
ALTER TABLE COLOR ADD UNIQUE (COLORNO);
/****************************/
this query on firebird1.5 result a error :
Select o.ColorId,max(c.name) colorname , max(c.colorno) colorno
from OrderColor O
join color c on (o.colorid = c.colorid)
group by o.colorid
order by o.workingorder
Dynamic SQL Error.
SQL error code = -104.
invalid column reference.
firebird 1.02 no error .
this query on firebird1.5 no error
Select o.ColorId,max(c.name) colorname , max(c.colorno) colorno
from OrderColor O
join color c on (o.colorid = c.colorid)
group by o.colorid ,o.workingorder
order by o.workingorder
what's wrong?
[Non-text portions of this message have been removed]