我在选择此更新时做错了什么

时间:2018-10-03 06:02:56

标签: mysql

我一直在尝试从选择中进行更新,控制台一直显示错误消息

您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以获取在'from'附近使用的正确语法   (     选择       a.id_activity作为统计信息       ,a.date_reg为l_clock   '在第5行

我希望能对此有所帮助。

update user_stat set
   clock_stat = a.stat
 , datetime_lclock = a.l_clock
 , date_fclock = a.f_clock
from
 (
Select
  a.id_activity as stat
  , a.date_reg as l_clock
  , date(c.date_reg) as f_clock
from log_activity a
  inner join
    (
      select
        max(id_reg) as last_Act,
        min(id_reg) as first_Act
      from log_activity
        where uid = 1
    )b on a.id_reg = b.last_Act
  left join log_activity c on c.id_reg = b.first_Act
)a
where uid = 1;

1 个答案:

答案 0 :(得分:1)

您需要稍后设置值,因此常规语法类似于:

ShowModal