gpt4 book ai didi

php - Group By 和 Where MySQL 查询

转载 作者:行者123 更新时间:2023-11-29 02:03:18 25 4
gpt4 key购买 nike

我想知道是否有人可以帮助我。

我正在使用下面的查询从 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com