Skip to content

在物理库上执行sql成功,在mycat2逻辑库执行报错 #815

@peowner

Description

@peowner

SELECT
COUNT( 0 ) ct,
any_value ( store_id ) id,
any_value ( store_name ) NAME,
any_value ( rec.store_type ) stype,
any_value (
DATE_FORMAT( rec.create_time, '%Y-%m-%d' )) dt,
any_value ( 0 ) AS type
FROM
op_order_hotel_accommodation_rec rec
INNER JOIN basic_hotel_info hotel ON hotel.id = rec.store_id
WHERE
rec.actual_checkin_time BETWEEN '2023-10-18'
AND '2023-11-24'
AND store_id = '1782421961759117546'
GROUP BY
id,
dt,
name,
stype,
type
UNION
SELECT
COUNT( 0 ) ct,
any_value ( store_id ) id,
any_value ( store_name ) NAME,
any_value ( rec.store_type ) stype,
any_value (
DATE_FORMAT( rec.create_time, '%Y-%m-%d' )) dt,
any_value ( 1 ) AS type
FROM
op_order_hotel_accommodation_abroad rec
INNER JOIN basic_hotel_info hotel ON hotel.id = rec.store_id
WHERE
rec.actual_checkin_time BETWEEN '2023-10-18'
AND '2023-11-24'
AND store_id = '1782421961759117546'
GROUP BY
id,
dt,
name,
stype,
type;

提示错误信息:
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Aggregate expression is illegal in GROUP BY clause。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions