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
,因为它甚至没有顶级字段,怎么做?
答案 0 :(得分:0)
为此使用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