SELECT $v1 as Id,
$v2 AS EmailAddress,
Count(*) AS Total,
BounceType,
IFNULL($v0,'') AS __a0,
IFNULL($v3,'') AS LastTime,
IFNULL(Contact,'') AS Contact
FROM ContactAction
LET $v0 = BounceInfo.Detail,
$v1 = Contact,
$v2 = Contact.Email.Address,
$v3 = Max(Request.At)
WHERE (Type=3 AND Campaign=#64:25) AND EntityInfo.State=0
GROUP BY Contact LIMIT 10
com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #419: Aggregate function cannot be used in LET clause together with GROUP BY Command: SELECT $v1 as Id, $v2 AS EmailAddress, Count(*) AS Total, BounceType, IFNULL($v0,'') AS __a0, IFNULL($v3,'') AS LastTime, IFNULL(Contact,'') AS Contact FROM ContactAction LET $v0 = BounceInfo.Detail, $v1 = Contact, $v2 = Contact.Email.Address, $v3 = Max(Request.At) WHERE (Type=3 AND Campaign=#64:25) AND EntityInfo.State=0 GROUP BY Contact LIMIT 10 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^
SELECT Contact,
Contact.Email.Address,
Count(*),
BounceType,
BounceInfo.Detail, Max(Request.At)
FROM ContactAction
WHERE (Type=3 AND Campaign=#64:25) AND EntityInfo.State=0
GROUP BY Contact LIMIT 10
create class TestClass
create property TestClass.Name string
create property TestClass.IntF integer
select Name, max (IntF) from TestClass group by Name
select Name, $v1 from TestClass LET $v1 = max(IntF) group by Name
com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error on parsing command at position #60: Aggregate function cannot be used in LET clause together with GROUP BY Command: select Name, $v1 from TestClass LET $v1 = max(IntF) group by Name