0

我有数据库,我想移动列 wutout 设置列类型。我有移动列的代码:

ALTER TABLE `table` MODIFY `aaa` decimal(20,2) NOT NULL AFTER `bbb`

对于检测列类型,我有以下代码:

SELECT column_type FROM information_schema.COLUMNS WHERE table_name='table' AND COLUMN_NAME = 'aaa'

当我在第二个代码上替换第一个代码变量类型时:

ALTER TABLE `table` MODIFY `aaa` (SELECT column_type FROM information_schema.COLUMNS WHERE table_name='table' AND COLUMN_NAME = 'aaa') NOT NULL AFTER `bbb`

我在 PhpMyAdmin 中有错误:

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以table在第 1 行的 '(SELECT column_type FROM information_schema.columns WHERE table_name = '附近使用正确的语法

问题出在哪里?

4

1 回答 1

0

你忘记了COLUMN

应该是这样的

   ALTER TABLE `table` MODIFY COLUMN `aaa` ...
于 2013-02-20T17:38:32.327 回答