请教sql语句 select a.*from aorder by isnull((select count(*) from b where newsid=a.id),0) desc,a.posttime 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 按评论数顺序排列:select a.*from aorder by isnull((select count(*) from b where newsid=a.id),0),a.posttime select a.* from 表a inner join (select newsid,count(comment) as countcom from 表b) border by b.countcom,a.posttime select a.* from 表a inner join (select newsid,count(comment) as countcom from 表b where b.newsid=a.id) border by b.countcom,a.posttime 触发器问题 条件分页存储过程 如何为视图创建全文索引 让系统无法插入一条重复记录,大家是怎么做的? 返回结果增加序列的问题! 请教一个简单的两表更新的语句 根据 某表的所有字段 创建新表 sql server 2008 连接到服务器报错 SQL Server 2005 备份错误 SQL中的查询问题 改变SQL Server 的缺省锁? 对于局部变量,text、ntext 和 image 数据类型无效
a.*
from
a
order by
isnull((select count(*) from b where newsid=a.id),0),a.posttime
inner join (select newsid,count(comment) as countcom from 表b) b
order by b.countcom,a.posttime
inner join (select newsid,count(comment) as countcom from 表b where b.newsid=a.id) b
order by b.countcom,a.posttime