3,491
社区成员
发帖
与我相关
我的任务
分享
SELECT id,url,title,text FROM
(
SELECT st.*,
Decode(InStr(url,'ABC'),0,4,1)order1,
Decode(InStr(title,'ABC'),0,4,2)order2,
Decode(InStr(text,'ABC'),0,4,3)order3
FROM st WHERE InStr(url,'ABC')>0 OR InStr(title,'ABC')>0 OR InStr(text,'ABC')>0
)ORDER BY ORDER1,ORDER2,ORDER3;
18:34:58 SCOTT@tdwora > select * from st
18:35:23 2 where instr(url,'ABC')>0
18:35:23 3 or instr(title,'ABC')>0
18:35:23 4 or instr(text,'ABC')>0
18:35:23 5 order by decode(instr(url,'ABC'),0,0,1) desc,
18:35:23 6 decode(instr(title,'ABC'),0,0,1) desc,
18:35:23 7 decode(instr(text,'ABC'),0,0,1) desc;
ID URL TITLE TEXT
---------- -------------------------------------------------- -------------------- --------------------
8 http://1ABC12 12321312 12ABC1231
2 http://2ABC31 312jf1 1231231
6 http://12312 12ABC2312 12ABC231
1 http://312312 ABC123 1231231
4 http://2312312 ABC345 1231231
7 http://112312 12123213 12ABC231
3 http://312312 456123 1231ABC
已选择7行。