doufuxi7093
2013-07-12 12:00
浏览 285
已采纳

按查询/ Mysql子查询的结果排序

Hi there (I'm new to PHP),

I can't quite figure out the syntax of a subquery I'm trying to make, this is the query:

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

Once this was done, I wanted to order those 10 selected rows by show_moyenne.moyenne with something like that:

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

Which is not correct, anybody can show me the right way to do this ?

Thanks, any help appreciated!

图片转代码服务由CSDN问答提供 功能建议

你好(我是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&lt;  '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&lt;'2013-07-12'
ORDER BY show_episode_airdate.airdate DESC LIMIT 10)
 * ORDER BY show_moyenne.moyenne DESC \  n   
 
 

哪个不正确,有人可以告诉我正确的方法吗?

谢谢,任何帮助表示赞赏!< / p>

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题