EmmyMiao87 opened a new issue #3290: Multi subquery in having clause URL: https://github.com/apache/incubator-doris/issues/3290 **Describe the bug** mysql> SELECT k1 FROM test GROUP BY k1 HAVING IFNULL((SELECT sum(k1) FROM baseall WHERE k1 = 2), (SELECT count(k1) FROM bigtable)) > 3; ERROR 1064 (HY000): errCode = 2, detailMessage = Unexpected exception: null mysql> SELECT * FROM baseall, test WHERE baseall.k1 = 1 AND test.k1 = 1 HAVING test.k2 = (SELECT MAX(k2) FROM baseall WHERE k2 = baseall.k2); ERROR 1064 (HY000): Required field 'node_type' was not present! Struct: TExprNode(node_type:null, type:TTypeDesc(types:[TTypeNode(type:SCALAR, scalar_type:TScalarType(type:SMALLINT))]), num_children:0, output_scale:-1) **To Reproduce** 1. create table mysql> desc all_type_table; +-------+--------------+------+-------+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-------+---------+-------+ | k1 | TINYINT | Yes | true | N/A | | | k2 | SMALLINT | Yes | true | N/A | | | k3 | INT | Yes | true | N/A | | | k4 | BIGINT | Yes | true | N/A | | | k5 | DECIMAL(9,0) | Yes | true | N/A | | | k6 | DOUBLE | Yes | false | N/A | NONE | | k7 | VARCHAR(20) | Yes | false | N/A | NONE | +-------+--------------+------+-------+---------+-------+ 7 rows in set (0.03 sec) 2. multi subquery in having clause select k1 from all_type_table group by k1 having ifnull((select sum(k1) from all_type_table where k1=2), (select count(k1) from all_type_table))>3; two subquery in having clause 3. subquery in having clause when there is no aggregation in stmt. select * from all_type_table a, all_type_table b having b.k2 = (select max(k2) from all_type_table where k2=all_type_table.k2); no group by ,no aggregation function
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org