请问下面的sql语句哪里错了?[SQL] SELECT
b.typename,
a.title,
a.click,
Count(c.msg) AS geshu,
c.username,
b.id,
a.typeid,
c.typeid
FROM
dede_archives AS a ON '' = ''
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedback AS c ON b.id = c.typeid
GROUP BY
b.typename,
a.title,
a.click[Err] 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 'ON '' = ''
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedb' at line 11
b.typename,
a.title,
a.click,
Count(c.msg) AS geshu,
c.username,
b.id,
a.typeid,
c.typeid
FROM
dede_archives AS a ON '' = ''
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedback AS c ON b.id = c.typeid
GROUP BY
b.typename,
a.title,
a.click[Err] 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 'ON '' = ''
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedb' at line 11
解决方案 »
- 如何在存储过程中判断insert是否成功
- 求一SQL 語句
- 救命:系统重装了,表没有备份,现在该怎么恢复数据啊?
- sql中表数据记录的提取
- MYSQL数据库查询的问题
- 请问各位的mysql用的JDBC是哪下的,怎么才能正确加载啊,为什么我在mysql网站下的JDBC不好用啊,是不是加载错了??
- Mysql+Myodbc,做管理系统,跨网络段,网络存取数据库效果不佳......,有做过的请帮忙
- 通过java向Mysql中插入图片
- MyEclipse与MySQL连接后,在数据库中建立teacher表,只要添加了position字段,jsp页面就报错
- MYSQL 导入dmp文件失败,怎么办
- mysql触发器问题
- 评论的表关系设计
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedb' at line 11
----------------------------------
去掉ON '' = ''
b.typename,
a.title,
a.click,
Count(c.msg) AS geshu,
c.username,
b.id,
a.typeid,
c.typeid
FROM
dede_archives AS a [del]ON '' = ''[/del]
Left Join dede_arctype AS b ON a.typeid = b.id
Left Join dede_feedback AS c ON b.id = c.typeid
GROUP BY
b.typename,
a.title,
a.click
[Err] 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 'ON '' = ''
lm1 测试文章1 136 5 游客 1 1
lm1 头条测试头条测试头条测试头条测试头条测试a 181 5 游客 1 1
lm1 图片测试2 108 5 游客 1 1
lm1 图片测试3 61 5 游客 1 1
结果中为什么geshu都是5
因为你的表中的geshu全部都是5
+---+------+------+
| a | b | flag |
+---+------+------+
| 1 | A | 1 |
| 2 | B | 1 |
| 3 | C | 1 |
+---+------+------+
3 rows in set (0.00 sec)mysql> select * from t;
+------+
| id |
+------+
| 0000 |
| 0000 |
| 0000 |
| 0001 |
| 0001 |
+------+
5 rows in set (0.02 sec)mysql> select * from t left join t1 on ""="";
+------+------+------+------+
| id | a | b | flag |
+------+------+------+------+
| 0000 | 1 | A | 1 |
| 0000 | 2 | B | 1 |
| 0000 | 3 | C | 1 |
| 0000 | 1 | A | 1 |
| 0000 | 2 | B | 1 |
| 0000 | 3 | C | 1 |
| 0000 | 1 | A | 1 |
| 0000 | 2 | B | 1 |
| 0000 | 3 | C | 1 |
| 0001 | 1 | A | 1 |
| 0001 | 2 | B | 1 |
| 0001 | 3 | C | 1 |
| 0001 | 1 | A | 1 |
| 0001 | 2 | B | 1 |
| 0001 | 3 | C | 1 |
+------+------+------+------+
15 rows in set (0.00 sec)我的没问题啊