BBS中父模块缩进,子模块归属父模块的实现方式
板塊顯示順序問題
在tbl_board表中增加一個顯示順序字段 order
alter table tbl_board
add ( order_num number(3) );
update tbl_board set order_num = 20 where boardname = '.NET技術';
update tbl_board set order_num = 21 where boardname = 'C#語言';
update tbl_board set order_num = 22 where boardname = 'WinForms';
update tbl_board set order_num = 23 where boardname = 'ADO.NET ';
update tbl_board set order_num = 24 where boardname = 'ASP.NET ';
update tbl_board set order_num = 10 where boardname = 'Java技術';
update tbl_board set order_num = 11 where boardname = 'Java基礎';
update tbl_board set order_num = 12 where boardname = 'JSP技術 ';
update tbl_board set order_num = 13 where boardname = 'Servlet技術 ';
update tbl_board set order_num = 14 where boardname = 'Eclipse應用';
update tbl_board set order_num = 30 where boardname = '數據庫技術';
update tbl_board set order_num = 31 where boardname = 'Oracle ';
update tbl_board set order_num = 32 where boardname = 'SQL Server';
update tbl_board set order_num = 40 where boardname = '娛樂';
update tbl_board set order_num = 41 where boardname = '灌水樂園';
commit;
-------------------------------------------------------------------------
清單查詢sql
select b.boardname , nvl(t1.topic_count , 0) as topic_count , t2.title , t2.uname , t2.publishtime
from tbl_board? b
left join ( select boardid , count(*) as topic_count from tbl_topic group by boardid ) t1 on b.boardid = t1.boardid
left join (
?select boardid ,title , uname , publishtime
?from tbl_topic t21
?join tbl_user u on t21.userid = u.userid
?where publishtime = (
??select max(publishtime)
??from tbl_topic t22
??where t22.boardid = t21.boardid
?)
) t2? on b.boardid = t2.boardid
order by b.order_num;
?
posted on 2012-09-24 20:16 moonfans 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/moonfans/archive/2012/09/24/2700613.html
總結
以上是生活随笔為你收集整理的BBS中父模块缩进,子模块归属父模块的实现方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: dota自走棋隐藏英雄
- 下一篇: ios12.3的设备管理在哪里(iOS1