请问下面的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

解决方案 »

  1.   

    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
    ----------------------------------
    去掉ON '' = ''
      

  2.   

    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 [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 '' = ''
      

  3.   

    lm2 sadfas 111 0 2 2
    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
      

  4.   


    因为你的表中的geshu全部都是5
      

  5.   

    mysql> select * from t1;
    +---+------+------+
    | 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)我的没问题啊