sql server 如何同时查询出 表内的第一条数据 和最后一条数据
sql:
select * from(select top 1 * from tblname order by id desc)
union
(select top 1 * from tblname order by id asc);
像这种的就不要再回答了哈
sql server 如何同时查询出 表内的第一条数据 和最后一条数据
sql:
select * from(select top 1 * from tblname order by id desc)
union
(select top 1 * from tblname order by id asc);
像这种的就不要再回答了哈
select * from table where id = (select max(id) from table) or id = (select min(id) from table)