当我 运行 TIME_TO_SEC 修改 GENERATED 列时,它会抛出错误,尽管 TIME_TO_SEC 在 SELECT 语句中独立工作正常
When I run TIME_TO_SEC to modify a GENERATED column, it throws an error although TIME_TO_SEC works fine independently in a SELECT statement
我是 运行 下面的 MySQL 脚本,它抛出一个错误,有人能告诉我哪里出了问题吗?
"ALTER TABLE class_sessions_archive MODIFY COLUMN session_time_computed int(11) AS TIME_TO_SEC(ends_on-starts_on)"
MySQL 中的错误消息仍然含糊不清,但是,我将其粘贴在这里:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TIME_TO_SEC(ends_on-starts_on)' at line 1
我只需要计算两个日期的差值并将其以秒为单位存储在新列中。我新建了一个专栏,现在想修改一下
表达式应放在括号中:
ALTER TABLE class_sessions_archive
MODIFY COLUMN session_time_computed int(11) AS (TIME_TO_SEC(ends_on - starts_on));
我是 运行 下面的 MySQL 脚本,它抛出一个错误,有人能告诉我哪里出了问题吗?
"ALTER TABLE class_sessions_archive MODIFY COLUMN session_time_computed int(11) AS TIME_TO_SEC(ends_on-starts_on)"
MySQL 中的错误消息仍然含糊不清,但是,我将其粘贴在这里:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TIME_TO_SEC(ends_on-starts_on)' at line 1
我只需要计算两个日期的差值并将其以秒为单位存储在新列中。我新建了一个专栏,现在想修改一下
表达式应放在括号中:
ALTER TABLE class_sessions_archive
MODIFY COLUMN session_time_computed int(11) AS (TIME_TO_SEC(ends_on - starts_on));