作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道是否有人可以帮助我。
我正在使用下面的查询从 MySQL 数据库中正确检索 Google 标记数据。
SELECT l.locationid, f.locationid, l.locationname, l.osgb36lat, l.osgb36lon, count(f.locationid) as totalfinds
FROM detectinglocations as l
LEFT JOIN finds AS f ON l.locationid=f.locationid
GROUP BY l.locationid
我现在正尝试通过添加一个 where
子句来对此进行补充,更具体地说是 where userid='$userid'
。
我已经尝试在查询中的不同位置添加这个额外的子句,我确信这可能只是初学者的错误,但我就是无法使查询正常工作。
我只是想知道是否有人可以看看这个并让我知道我要去哪里错了。
谢谢和亲切的问候
最佳答案
尝试在 GROUP BY 之前添加 where 子句。
关于php - Group By 和 Where MySQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11101293/
我是一名优秀的程序员,十分优秀!