Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
peowner opened this issue Dec 4, 2023 · 0 comments
Open

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

peowner opened this issue Dec 4, 2023 · 0 comments

Comments

@peowner
Copy link

peowner commented Dec 4, 2023

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。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant