比如表中有好多数据,小弟我想查最后一条,但是这个表对信息没有编号,小弟我要如何查最后一条的信息呢?
比如表中有好多数据,我想查最后一条,但是这个表对信息没有编号,我要怎么查最后一条的信息呢??
多谢
------解决方案--------------------
--如何从表中用SELECT语句提取最后1条数据
多谢
------解决方案--------------------
--如何从表中用SELECT语句提取最后1条数据
- SQL code
declare @num as int select @num = count(*) from authors set @num = @num - 1 declare @sql as varchar(200) set @sql = 'select * from authors where au_id not in (select top ' + cast(@num as char) + ' au_id from authors)' exec (@sql)