Sql语法错误Golang

时间:2017-02-21 07:55:59

标签: mysql go

我刚开始学习Golang。

我在Golang源ExampleDB_Query_multipleResultSets

中关注了example_test

然后我可能修改了我的查询:

`
create table uid (id bigint);

select id from user where age < ?;

SELECT user.id, user.name FROM user JOIN uid ON user.id = uid.id;

select ur.user, ur.role from user_roles as ur join uid on uid.id = ur.user;
`

表用户:

+-------+--------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+--------------+------+-----+---------+----------------+
| name  | varchar(255) | YES  |     | NULL    |                |
| age   | int(11)      | YES  |     | NULL    |                |
| id    | int(11)      | NO   | PRI | NULL    | auto_increment |
+-------+--------------+------+-----+---------+----------------+

和uid:

+-------+------------+------+-----+---------+-------+
| Field | Type       | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| id    | bigint(20) | YES  |     | NULL    |       |
+-------+------------+------+-----+---------+-------+

我收到了日志中的错误:

2017/02/21 14:44:08 Error 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 'select id from user where age < ?;

SELECT user.id, user.name FROM user JOIN uid' at line 3
exit status 1

0 个答案:

没有答案