请问下面的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
解决方案 »
- 如何计算树的深度的?
- 请教一个MYSQL两表关联的效率问题。(每张表2000W条数据)
- 从服务器同步时,发生Invalid default value for '%s' 问题
- 请问历史数据的实现思路(mysql)
- 不用查询分析器创建数据库
- 请问如何在论坛中实现文章翻到上一主题下一主题!SQL语句怎么写?
- 怎么没人理我啊!!希望 insert 语句执行的返回值是所插入记录的key字段,可以怎样实现? 望高手指点
- mysql語句的一個問題????
- mysql能不能实现这样的查询?
- 用SQL SERVER2008每天插入100W数据查询100W次,请教各路大神应该如何设计表?
- 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)我的没问题啊