asp中,這句sql怎麼寫請指點

時間 2022-07-12 03:10:04

1樓:歐力士中國

select name ,age from b where age in (select max(age) from b) union

select name,age from b where age in (select max(age) from b where age not in (select max(age) from b))

執行結果是

xiaoli 79

xiaoming 80

xiaon 79

xiaow 80

2樓:

select top 2 * from table order by age desc

3樓:匿名使用者

select top 2 * from 表 order by age

4樓:

1. sql server 7: 用 top n (with ties)

如:select top 2 with ties * from mytable order by age;

2. oracle 8i: 用 rownum<=n如:

select * from mytable where age>= (select min(age) from ( select * from mytable order by age desc) where rownum<=2) order by age desc;

語句已經測試過

ASP中一條SQL語句請高人指點

select max id as id,max bigclassname as bigclassname,bm from table where bigclassname 2001 group by bm select from table where id in select max id fro...

在access中怎麼寫sql查詢語句,select查詢出

由於sql語言處理問題的方式是面向記錄 集合 的。解決排名這類問題對於sql來說確實頭疼,分組排名就更不用說了!為了解決排名問題大型資料庫系統為使用者提供了rank rownumber等函式,但是access不支援排名 開窗等這類函式,一般建議用程式設計方式解決,例如vba等。這個問題確實不好回答。...

在資料表中新增欄位的sql語句怎麼寫

資料表中新增一個欄位的標準sql語句寫法為 alter table 表名 add 欄位 欄位型別 default 輸入預設值 null not null 舉例 alter table employee add spbh varchar 20 not null default 0 意思就是在表empl...