shakoon
2020-07-04 18:23:56 +08:00
说实话我没看懂这个拉屎人的目的,left join 一堆东西但最后都没有用到 join 得到的字段。
SELECT AA.PLATFORM_REQUEST_CODE AS PLATFORMREQUESTCODE,
AA.AGGTEGATE_REQUEST_CODE AS AGGTEGATEREQUESTCODE,
AA.CREATE_TIME AS CREATETIME,
AA.STATUS AS PAYSTATUS,
AA.MERCHANT_GENERATE_CODE AS PLATFORMCODE,
AA.USER_CODE AS BUYCODE,
AA.CHANNEL_NO AS CHANNELNO
FROM TB_AGGTEGATE_PAYMENT_REQUEST AA
LEFT JOIN TB_CHANNEL_SEND_REPORT BB
ON BB.DEL_FLAG = 0
AND AA.AGGTEGATE_REQUEST_CODE = BB.CHANNELAGGTEGATEREQUESTCODE
LEFT JOIN TB_MERCHANT_INFO CC
ON CC.DEL_FLAG = 0
AND CC.MERCHANT_INFO_CODE = AA.MERCHANT_GENERATE_CODE
LEFT JOIN TB_USER_INFO DD
ON DD.DEL_FLAG = 0
AND AA.USER_CODE = DD.PLATFORM_USER_CODE
LEFT JOIN TB_CHANNEL_INFO EE
ON EE.DEL_FLAG = 0
AND AA.CHANNEL_NO = EE.CHANNEL_CODE
LEFT JOIN TB_WXPAY_ORDER_BUSINESS FF
ON FF.DEL_FLAG = 0
AND FF.IS_VALID = 0
AND AA.AGGTEGATE_REQUEST_CODE = FF.AGGTEGATE_REQUEST_CODE
WHERE AA.STATUS != '00'
AND AA.DEL_FLAG = 0
AND AA.IS_VALID = 0
ORDER BY AA.CREATE_TIME DESC