SQL where语句求解 我想写出类似这种的SQL,该如何写,哪位高人给个思路先 select * from table where when 条件1:表达式1-表达式2>=0when 条件2:表达式1-表达式2>0 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 表达式1 > 表达式2and (case when 条件1 then 表达式1-表达式2 ) = 0 表达式1 > 表达式2and (case when 条件1 then 表达式1-表达式2 else 0 end ) = 0 给你个例子参考一下SQL> select * from t4; ID1 ID2---------- ---------- 1 2 3 2 5 2 2 2 7 2 7 2 6 rows selected SQL> select * from t4 where id1=(case when id1=7 then id1 else id2 end); ID1 ID2---------- ---------- 2 2 7 2 7 2 SQL> oracle高手过来看下,小弟感激啊 plsql developer的使用方法 请教一个关于自然连接的问题 oracle的全文检索技术如何模糊查询? 如何查看对一个表做了哪些Update,Delete操作 Oracle 身份自助服务 游标中表名可以用变量吗? oracle 和sql server 2000之间数据的导入导出 ★★★★★oracle是否有丢失记录的现象,碰到过的兄弟来聊聊★★★★★ 如何建新數據庫? 创建数据表时出现:非法的变量名/编号 关于往一个表中插入blob数据时引发的问题~~~~
and
(case when 条件1 then 表达式1-表达式2 ) = 0
and
(case when 条件1 then 表达式1-表达式2 else 0 end ) = 0
SQL> select * from t4;
ID1 ID2
---------- ----------
1 2
3 2
5 2
2 2
7 2
7 2
6 rows selected
SQL> select * from t4 where id1=(case when id1=7 then id1 else id2 end);
ID1 ID2
---------- ----------
2 2
7 2
7 2
SQL>