--查询商品对应的所有票价都是售完状态的商品 select tp.productid from t_product tp where not exists( select 1 from t_productplay tpp where tpp.productid = tp.productid and tpp.starus != 2 -- 2:售完 )
-------------------
--订单状态为未审核,订单类型为选座或抢座,订单支付状态为部分支付,且支付详情中不存在电子钱支付方式之外的已支付的记录。
select t.ordersid, t.customersid,tm.paymentid,t.createtime,t.starus,tm.paystatus,tm.discount,
(select nvl(sum(tpd.actual_fee),0) from t_payment_detail tpd where tpd.order_id=t.ordersid and tpd.discountdetailid=66985007 and tpd.payment_status=1
) as yckprice
from t_orders t, t_payment tm
where t.starus = 1 and tm.paystatus = 1 and (t.type = 1 or t.type = 20) and tm.ordersid = t.ordersid and trunc(t.createtime) <= trunc(sysdate)
--订单类型为选座或抢座,状态为未审核,支付状态为部分支付,
and not exists(
select 1 from t_payment_detail tpd
where tpd.order_id=t.ordersid and tpd.discountdetailid not in(66985007) and tpd.payment_status=1
);
--所有支付详情没有这种情况:支付状态为已支付,支付方式不是电子钱包
分享到:
相关推荐
oracle笔记子查询,有子查询相关的知识点笔记和具体的案例代码!
ORACLE子查询
oracle 数据库的子查询的相关内容,新手可以多看看
Oracle 子查询
复杂相关子查询 动画版
oracle表连接和子查询实例 所有的实例查询都包含在里面,不会担心笔试oracle子查询。
oracle子查询学习教案.pptx
oracle中的子查询使用场合,种类,使用方法,错误排除
oracle笔记高级子查询,oracle中的高级子查询有点难度,不太好理解,有具体的案例代码!
Oracle经典教程3——子查询和常用函数
通过本章学习,您将可以: 书写多列子查询 子查询对空值的处理 在 FROM 子句中使用子查询 在SQL中使用单列子查询 ...书写相关子查询 使用子查询更新和删除数据 使用 EXISTS 和 NOT EXISTS 操作符 使用 WITH 子句
oracle子查询PPT课件.ppt
oracle select group 子查询 表连接
oracle子查询PPT课件.pptx
oracle代码oracle代码 oracle代码oracle代码
oracle子查询PPT学习教案.pptx
简单的介绍oracle子查询语句的使用,
Oracle子查询实例代码演示 详细而具体
Oracle子查询优化的最佳实践.pptx