Oracel查詢表中某字段值為去重後第幾的記錄

2021-07-15 16:24:46 字數 647 閱讀 3594

自己的一點心得,記錄一下。

select distinct sal from emp order by sal desc;

select sal, rownum rn from (select distinct sal from emp order by sal desc) where rownum < 4

select sal from (select sal, rownum rn from (select distinct sal from emp order by sal desc) where rownum < 4) where rn > 2

select * from emp where sal = (select sal from (select sal, rownum rn from (select distinct sal from emp order by sal desc) where rownum < 4) where rn > 2)

/*要求:在員工表中查詢出工資第三高(去重)的員工資訊:

1. 去重查詢工資;

2. 從得到的結果中查詢出前三條記錄;

3. 從到的結果中查詢出第三條記錄的工資值;

4. 根據3中得到的值,從員工表中查詢出員工資訊。

*/

Sql查詢按某字段值排序

1.sql查詢資料 select from emapiauthorizeinfo order bycase when d76c63ec d885 40b4 ad58 e950ebba74bf then 1when be1581ea d3d1 4342 a427 2027faee26db then 2...

查詢某欄位名在哪些表中

select name from sysobjects where id in select id from syscolumns where name fieldname 所有使用者表資訊在 系統表sysobjects中,所有使用者表字段資訊在系統表syscolumns中 通過下面sql得到當前資...

mysql 按值查詢與替換欄位中的某字

mysql 按值查詢 update 表名 set 欄位名 設定值 where cslx 原始值 替換欄位中的某字 msql裡面的某個表的某個字段裡面儲存的是乙個人的位址,有一天這個位址的裡面的某個地 比如 原來是 number addr 01 四川省成都市 街道05號 02 四川省成都市 街道07號...