三个查询的区别

三个查询的区别
select count(*) from (select tm.cust_id,
        max(tm.so_payment_date) as end_date from tc_sales_order_m tm
       group by tm.cust_id) td where td.end_date < add_months(sysdate,-3)


select count(*) from (select tm.cust_id,tm.emp_id,tm.so_id,tm.so_code,tm.so_delivery_date, tm.so_PAYMENT_DATE, max(tm.so_payment_date) as end_date
          from tc_sales_order_m tm
         group by tm.cust_id,emp_id,so_id,so_code,so_delivery_date,so_PAYMENT_DATE) td
 where td.end_date < add_months(sysdate, -3)
 
 select count(*)
  from (select tm.cust_id, max(tm.so_payment_date) as end_date
          from tc_sales_order_m tm
         where tm.owner_id = 1
         group by tm.cust_id) td,
       tc_sales_order_m tdd
 where td.end_date < add_months(sysdate, -3)
       and td.cust_id = tdd.cust_id(+)
      

你可能感兴趣的:(三个查询的区别)