我们有2个非常简单的SELECT语句:
SELECT value from table where date between DATE1 and DATE2 SELECT value from table where date between DATE3 and DATE4
我们需要一种方法来编写单个sql语句,它将获得从这两个sql语句返回的“值”的差异.
我们尝试了以下但是没有成功:
SELECT value from table where date between DATE1 and DATE2 minus SELECT value from table where date between DATE3 and DATE4
任何建议都非常感谢.
未经测试但应该工作:
原文链接:https://www.f2er.com/oracle/205167.htmlSELECT (SELECT value from table where date between DATE1 and DATE2) - (SELECT value from table where date between DATE3 and DATE4) FROM dual;
假设您的SELECT值保证返回单个值