怎样才能检索出最后一条记录? SQLServer中的记录没有前后之分.如果有升序的主键。select top 1 * from tablename order by 主键 desc 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @a intselect @a=count(*) from yourtableset towcount @aselect * from yourtable declare @a intselect @a=count(*) from yourtableselect identity(int,1,1) id,* into #temp from yourtableselect * from #temp where id=@a declare @id intselect @id = max(主键) from table select * from table where 主键 = @id select identity(int,1,1) as id,* into #tempfrom yourtableselect top 1 * from #temp order by id descdrop table #temp "BottomCount从集合底端开始返回指定数目的项,可以选择首先对集合排序。示例BottomCount(Geography.Cities.Members, 5, Sales)"这是我在SQL帮助里查到的,这怎么用啊 BottomCount是Analysis Services中MDX语法 sql2000在win7上不能安装 表与表数据的部分同步 sql创建数据表字符长度 为什么创建了两个或两个以上的惟一约束,约束就不起作用了? 最近要做SQL语句优化的工作,帮帮我。。。 OLE/DB provider returned message: 找不到可安装的 ISAM 怎么插入两条数据啊。。 问一个数据复制问题 大家看看是怎么回事? group by分组问题 在执行邹老大的sql时有点错误,怎么解决? 求SQL语句
select @a=count(*) from yourtable
set towcount @a
select * from yourtable
select @a=count(*) from yourtableselect identity(int,1,1) id,* into #temp from yourtable
select * from #temp where id=@a
select @id = max(主键) from table
select * from table where 主键 = @id
select identity(int,1,1) as id,*
into #temp
from yourtableselect top 1 * from #temp
order by id descdrop table #temp
从集合底端开始返回指定数目的项,可以选择首先对集合排序。
示例
BottomCount(Geography.Cities.Members, 5, Sales)"
这是我在SQL帮助里查到的,这怎么用啊
是Analysis Services中MDX语法