gpt4 book ai didi

mysql - 有一个 mysql 查询,我希望能够从第二个表运行 order by

转载 作者:行者123 更新时间:2023-11-30 00:43:38 26 4
gpt4 key购买 nike

SELECT * 
FROM app_detailsvvv as dtable
WHERE primaryGenreName='".$ov['title']."'
AND composed='1' AND
(SELECT COUNT(*) as c
FROM new_apps
WHERE trackId=dtable.trackId AND top>0) > 0
ORDER BY top ASC

我在这里想要做的是ORDER BY表new_apps的顶部而不是app_detailsvvv,因为它甚至没有顶部字段,该怎么做?

最佳答案

为此使用INNER JOIN。这将是您的查询:

SELECT dtable.* FROM app_detailsvvv as dtable 
INNER JOIN new_apps ON new_apps.trackId=dtable.trackId
WHERE primaryGenreName='".$ov['title']."'
AND composed='1' AND
(SELECT COUNT(*) as c
FROM new_apps
WHERE trackId=dtable.trackId AND top>0) > 0
ORDER BY new_apps.top ASC

关于mysql - 有一个 mysql 查询,我希望能够从第二个表运行 order by,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21568679/

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