mysql - mysql快速查询问题

标签 mysql

抱歉,我不想问这样的具体问题,但这让我精神错乱!

肯定有一些明显的东西是我遗漏的:

表格:

|ven_name|varchar(150)|No|
|ven_sd|varchar(90)|Yes|NULL
|ven_details|varchar(3000)|Yes|NULL
|ven_tel|varchar(30)|Yes|NULL
|ven_email|varchar(50)|Yes|NULL
|ven_address|varchar(300)|Yes|NULL
|lat|decimal(9,6)|Yes|NULL
|long|decimal(9,6)|Yes|NULL
|pub|tinyint(4)|Yes|NULL
|bar|tinyint(4)|Yes|NULL
|club|tinyint(4)|Yes|NULL
|img_added|tinyint(4)|Yes|NULL

查询:

INSERT INTO ven
            (img_added,
             ven_name,
             ven_sd,
             ven_tel,
             ven_email,
             ven_address,
             lat,
             long,
             pub,
             ven_details)
VALUES     (1,
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            100,
            156,
            1,
            'aaa') 

错误:

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 'long, pub, ven_details) VALUES(1, 'aaa', 'aaa', '0117 9246449', 'aaa', 'aaa', 10' at line 1

最佳答案

'long' 是 MySQL 中的保留字。使用反引号转义:

http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

关于mysql - mysql快速查询问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2713256/

相关文章:

php - MySQL 说 : Documentation (#1064) - You have an error in your SQL syntax;

mysql - 按字符串的一部分连接

mysql if 条件

php - Sphinx 实时索引 UPDATE 语句不影响所有行

php - 多个 MYSQL 查询与多个 php foreach 循环

PHP 更新数据库不工作

使用字符串操作的 PHP SQL 注入(inject)预防

mysql - SQLAlchemy 错误插入多个对象

php - MySQL/PHPMyAdmin

php - 使用新的 wp_query 将 sql 查询转换为 wordpress 查询