gpt4 book ai didi

php - 按查询结果排序/Mysql 子查询

转载 作者:太空宇宙 更新时间:2023-11-03 12:26:05 25 4
gpt4 key购买 nike

您好(我是 PHP 新手),

我不太明白我要创建的子查询的语法,这是查询:

SELECT * FROM show_episode, shows, show_episode_airdate, show_moyenne 
WHERE season = 1 AND episode = 1
AND shows.imdb_id = show_episode.imdb_id_show
AND show_episode_airdate.episode_id = show_episode.episode_id
AND show_moyenne.show_id = shows.id
AND show_episode_airdate.airdate < '2013-07-12'
ORDER BY show_episode_airdate.airdate DESC LIMIT 10

完成此操作后,我想通过 show_moyenne.moyenne 对这 10 个选定的行进行排序:

SELECT * (FROM show_episode, shows, show_episode_airdate, show_moyenne 
WHERE season = 1 AND episode = 1
AND shows.imdb_id = show_episode.imdb_id_show
AND show_episode_airdate.episode_id = show_episode.episode_id
AND show_moyenne.show_id = shows.id
AND show_episode_airdate.airdate < '2013-07-12'
ORDER BY show_episode_airdate.airdate DESC LIMIT 10)
* ORDER BY show_moyenne.moyenne DESC

这是不正确的,任何人都可以告诉我正确的方法吗?

谢谢,感谢任何帮助!

最佳答案

Select * from 
(SELECT * FROM show_episode, shows, show_episode_airdate, show_moyenne
WHERE season = 1 AND episode = 1
AND shows.imdb_id = show_episode.imdb_id_show
AND show_episode_airdate.episode_id = show_episode.episode_id
AND show_moyenne.show_id = shows.id
AND show_episode_airdate.airdate < '2013-07-12'
ORDER BY show_episode_airdate.airdate DESC LIMIT 10) as j
order by j.moyenne DESC

希望对您有所帮助。

关于php - 按查询结果排序/Mysql 子查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17614474/

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