这个SQL的where子句错了,可是我不知道是哪里
来源:百度知道 编辑:UC知道 时间:2024/08/22 19:53:08
SELECT DISTINCT s.username as username,s.uid as userid,s.credit as plnum,s.viewnum as onclick,b.blogid as id,b.subject as title,FROM_UNIXTIME(b.dateline) as newstime FROM uchome_space s INNER JOIN uchome_blog b ON s.uid=b.uid WHERE s.username = aessjz GROUP BY s.uid ORDER BY s.viewnum DESC LIMIT 3
WHERE s.username = 'aessjz'
where s.username = aessjz 错了,字符串要加单引号才对。
where s.username = 'aessjz'
你留下你的QQ咯,我来告诉你
DISTINCT 和group by就不能混用
其他错误自己检查,再说了,你这东西用group by 有什么用啊
group by是分组汇总,你这里也没有要求汇总的东西啊,如sum函数
SELECT DISTINCT s.username as username,s.uid as userid,s.credit as plnum,s.viewnum as onclick,b.blogid as id,b.subject as title,FROM_UNIXTIME(b.dateline) as newstime FROM uchome_space s INNER JOIN uchome_blog b ON s.uid=b.uid WHERE s.username = 'aessjz'
GROUP BY s.username ,s.uid ,s.credit ,s.viewnum ,b.blogid ,b.subject ,FROM_UNIXTIME(b.dateline)
ORDER BY s.viewnum DESC LIMIT 3
不是WHERE条件的问题,是Select查询的列FROM_UNIXTIME(b.dateline) 不符合规范 和排列条件最后的LIMIT 3 的语法问题