SQL 子查询和排序问题
新亿 2007-08-04 04:53:29 我在做 asp.net 项目时
根据在子类表(class_db)
想在前台显示 文章列表示前9个,之后还要 art_time (文章时间来显示) 降序排列
我的Sql语句如下
string mysql="select top 9 art_id,art_title from art_db where art_c_id=(select class_id from class_db where class_name='游戏天地') ORDER BY art_time DESC";
在前台是用 DataList 帮定的,如果不排序,是显示9个数据
但是加上 ORDER BY art_time DESC 的话 她全部显示出来了,也有排序效果