当前位置: 代码迷 >> Sql Server >> 字段查询?该如何处理
  详细解决方案

字段查询?该如何处理

热度:44   发布时间:2016-04-27 18:54:10.0
字段查询????
怎么查询表Face中字段id的最后一行,并获得取它的值???

------解决方案--------------------
select top 1 id
from face
order by id desc
------解决方案--------------------
select top 1 id
from face
order by id desc
go
------解决方案--------------------
select top 1 id from face order by id desc
------解决方案--------------------
create table face(id int identity(1,1) primary key not null, face_id int )

insert into face

select 1 union all
select 1 union all
select 1 union all
select 1
------解决方案--------------------
select scope_identity() as maxID
  相关解决方案