这种MySQL语法有什么问题?

时间:2018-06-21 09:21:21

标签: mysql sql

这是怎么了?

我从本地pma导出了该表,并尝试将其上传到远程服务器上。

CREATE TABLE IF NOT EXISTS `posts` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `banna` text COLLATE utf8_croatian_ci,
  `bannb` text COLLATE utf8_croatian_ci,
  `img` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `images` text COLLATE utf8_croatian_ci,
  `title` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `subtitle` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `story` mediumtext COLLATE utf8_croatian_ci,
  `status` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `tags` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `auth` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `moder` varchar(255) COLLATE utf8_croatian_ci DEFAULT NULL,
  `linked` json DEFAULT NULL,
  `inde` int(11) DEFAULT NULL,
  `count` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=382 DEFAULT CHARSET=utf8 COLLATE=utf8_croatian_ci

错误:

#1064 - 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 'json DEFAULT NULL,
  `inde` int(11) DEFAULT NULL,
  `count` int(11) DEFAULT NULL' at line 15

1 个答案:

答案 0 :(得分:2)

我已经在5.7.21版的mysql上运行了您的查询,它工作正常,没有引发错误,所以在我看来,您的站点中出现了与mysql版本相关的问题,这是执行结果

$project = db::table('project as p')->where('p.code',$asset_request->project_code);
$project_type = $project->select('p.practice_string_id','p.program_string_id')->first();

0行受影响1.535秒