在 MySQL 的子查询中获取错误消息 1064

问题描述 投票:0回答:0

我在 Mysql 中遇到以下错误:

**错误:错误代码:1064。您的 SQL 语法有误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 11 行的 ')' 附近使用的正确语法 **

select e.user_id,sum(total_points) Total_points_earned from
       (select e.*,round(amount/points ,0)total_points from
            (select d.*, case when product_id=1 then 5
                when product_id=2 then 2
                 when product_id=3 then 5
                 else 0
                end as points from
                     (select c.userid,c.product_id,sum(price) amount from
                            (select a.*,b.price from sales a join product b on  .product_id=b.product_id)c
                                    group by userid,product_id)d)e)f
                                      group by userid,product_id)

有人可以帮我吗?

查询应该成功运行。

mysql join subquery inner-join
© www.soinside.com 2019 - 2024. All rights reserved.