表的例子結構:
tbltest4:
id 2312
3456
78955
76 1、選取最大的數
select
max(id)
from tbltest4
2、選取最大的三個數
select
top 3 *
from tbltest4
order
by id
desc
3、選取第2大的數
select
top 1 a.*
from (
select
top 2 *
from tbltest4
order
by id
desc) a
order
by id
asc或者
select *
from tbltest4
where id=
(
select
max(id)
from tbltest4
where id
notin(
select
max(id)
from tbltest4)
)
4、選取第3大的數
select
top 1 a.*
from (
select
top 3 *
from tbltest4
order
by id
desc) a
order
by id
asc5、選取最小的數
select
min(id)
from tbltest4
6、選取第2小的數
select
top 1 a.*
from (
select
top 2 *
from tbltest4
order
by id
asc) a
order
by id
desc
或
select *
from tbltest4
where id=
(
select
min(id)
from tbltest4
where id
notin(
select
min(id)
from tbltest4)
)
7、選取第3小的數
select
top 1 a.*
from (
select
top 3 *
from tbltest4
order
by id
asc) a
order
by id
desc
獲取每年的第幾周集合
public class dateutil else if time.length 110 date date new date dateformat sdf new dateformat yyyy mm dd hh mm ss try catch exception e string last12...
獲取當天是當年 當月的第幾周
引用命名空間 using system.globalization 示例 datetime date datetime.now 獲取指定時間是當年的第幾周 gregoriancalendar gc new gregoriancalendar int weekofyear gc.getweekofye...
獲取當天是當年 當月的第幾周
引用命名空間 using system.globalization 示例 datetime date datetime.now 獲取指定時間是當年的第幾周 gregoriancalendar gc new gregoriancalendar int weekofyear gc.getweekofye...