Home > Backend Development > PHP Tutorial > php从帖子表读出数据进行排序有关问题

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

WBOY
Release: 2016-06-13 12:30:36
Original
846 people have browsed it

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来查询了!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template