Hello,

I tried executing the following query in Phoenix:
select distinct W."rowId", W."md5_current", W."size_current" from "Wiki" AS
W where EXISTS( select MAX(H."timestamp") from "History" AS H where
(H."rowId" = W."rowId") AND (H."status" = 'approved') );

I got the following error:
ERROR 1018 (42Y27): Aggregate may not contain columns not in GROUP BY.
(state=42Y27,code=1018)

If I replace W."rowId" (in the where clause) with a constant value (for
example: '3587'), the query works fine. Also, if I replace the aggregate
MAX(H."timestamp") with H."timestamp", the query also works fine.

So it seems that Phoenix generates error when using a reference to an outer
query while using an aggregate within the inner query.

Any solutions?



Regards,

Khaleel Mershad, Ph.D.
Research Associate

American University of Beirut
Department of Electrical and Computer Engineering
Bliss Street, Beirut, Lebanon
email: kw...@aub.edu.lb

Reply via email to