select top n 是取查询结果的前 n 条记录,如果你的结果多于 30 条。那么用 select top 30 查到的结果就只是 30 条。
解决方案 »
- jquery 支持安卓等手机web开发不?
- 判断CHECKBOX是否选中
- 关于radio值的问题,谢谢
- 获取treeview某节点的父节点个数。
- 超链接如何不往自己网站跳转?
- 内嵌javascript网页在ios或android上能否获取OS固件版本号
- 拖动控制左右大小,当一边为iframe时,鼠标拖出中间条时失效
- 关于FORM的ID问题,高难啊.........各位帮帮忙
- Window.Open 方法不执行
- 如何让这两个计时器同时使用起来???急急急~
- 100分求一个事件问题 第一个给出解决方案者得100分!!!
- <input name="btnSltArea" type="button" class="select_style" style="BACKGROUND-IMAGE: url(http://images.51job.com/im/mainimg/btn_
我没有说清楚.
是我之后加进去的新数据都不显示了很奇怪
就是最新的lstcmt_date
select * from
(select top 30
[auto_tpc_id]
,t.[flag]
,[checkboxid]
,[tpc_uid]
,[tpc_nick]
,[lstcmt_uid]
,[lstcmt_nick]
,[lstcmt_date]
,[tpc_title]
,[tpc_date]
,[count_read]
,[tpc_img]
,count(c.[tpc_id]) as count_cmt
from [goodluck].[dbo].[topicInfo] as t
left join [goodluck].[dbo].[commentInfo] as c
on t.auto_tpc_id = c.[tpc_id] and c.[flag] = '0'
where t.flag = '0'
group by
[auto_tpc_id]
,t.[flag]
,[checkboxid]
,[tpc_uid]
,[tpc_nick]
,[lstcmt_uid]
,[lstcmt_nick]
,[lstcmt_date]
,[tpc_title]
,[tpc_date]
,[tpc_img]
,[count_read] order by [lstcmt_date] desc--内联表加上排序
) as e
where flag = '0' AND e.[auto_tpc_id]
not in (select top 0 [auto_tpc_id]
from [goodluck].[dbo].[topicInfo]
where flag = '0' order by [lstcmt_date] desc)
order by [lstcmt_date] desc