Heim  >  Artikel  >  Backend-Entwicklung  >  php从帖子表读出数据进行排序有关问题

php从帖子表读出数据进行排序有关问题

WBOY
WBOYOriginal
2016-06-13 11:43:44711Durchsuche

php从帖子表读出数据进行排序问题
posts帖子表
posts_hot帖子相关信息表
posts_hot表ID关联Posts表
posts_hot表中的hot_top是表示该帖子置顶
posts表中的posts_dt_time是表示该帖子最新回复时间
问题是:根据论坛ID读出帖子列表,让帖子置顶在保持在最上面,其他的按最新回复时间排序!
sql
select p.*,u.*,ph.* from posts p,users u,posts_hot ph where p.forumid=$forumid and p.userid=u.user_id and p.hotid=ph.hot_id order h.hot_top;
这样只能按置顶的在前面,后面添加posts_dt_time就乱了,有什么办法解决么,我不想再分出SQL来查询了!

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn