EXISTS 的使用

SELECT
 uuid,
 fund_no,
 company_name,
 proj_company_name,
 regional_company,
 factor_amt,

IF (
 is_export_flag = 0,
 '未导出',
 '已导出'
) AS is_export_flag
FROM
 biz_lh_payment_info a
WHERE
 sys_status = 1
AND  EXISTS (
 SELECT
  pay_content
 FROM
  biz_pay_comfirm_info
 WHERE
  pay_content = a.fund_no
 AND sys_status = 1
)
AND NOT EXISTS (
 SELECT
  pay_content
 FROM
  biz_pay_comfirm_info
 WHERE
  pay_content = a.fund_no
 AND sys_status = 1
 AND suppliers_money <> ''
)
AND fund_no NOT IN (
 SELECT
  a.pay_content
 FROM
  biz_pay_comfirm_info a,
  biz_rollback_pay b
 WHERE
  a.uuid = b.pay_id
 AND b.biz_state <> 15
 AND b.sys_status = 1
)

 

posted on 2019-07-16 16:00  小白菜好吃  阅读(196)  评论(0编辑  收藏  举报

导航