SELECT a.*
FROM (
SELECT a.*
FROM (
SELECT a.*
FROM (
SELECT a.*
FROM (
SELECT a.*
FROM (
SELECT
PLATFORM_REQUEST_CODE AS platformRequestCode
, AGGTEGATE_REQUEST_CODE AS aggtegateRequestCode
, CREATE_TIME AS createTime
, STATUS AS payStatus, MERCHANT_GENERATE_CODE AS platformCode
, USER_CODE AS buyCode
, CHANNEL_NO AS channelNo
FROM tb_aggtegate_payment_request
WHERE STATUS != '00' AND DEL_FLAG = 0 AND IS_VALID = 0
ORDER BY CREATE_TIME DESC
) `a` LEFT JOIN (
SELECT CHANNEL_REQUEST_CODE AS channelOrderCode, AGGTEGATE_REQUEST_CODE AS channelaggtegateRequestCode
FROM tb_channel_send_report WHERE DEL_FLAG = 0
) `b` ON a.aggtegateRequestCode = b.channelaggtegateRequestCode
) `a` LEFT JOIN (
SELECT MERCHANT_INFO_CODE, MERCHANT_INFO_NAME AS platformName
FROM tb_merchant_info
WHERE DEL_FLAG = 0
) `c` ON c.MERCHANT_INFO_CODE = a.platformCode
) `a` LEFT JOIN (
SELECT PLATFORM_USER_CODE, MERCHANT_NAME AS merchantName
FROM tb_user_info
WHERE DEL_FLAG = 0
) `b` ON a.buyCode = b.PLATFORM_USER_CODE
) `a` LEFT JOIN (
SELECT CHANNEL_CODE, CHANNEL_NAME AS channelName
FROM tb_channel_info
WHERE DEL_FLAG = 0
) `b` ON a.channelNo = b.CHANNEL_CODE
) `a` LEFT JOIN (
SELECT AGGTEGATE_REQUEST_CODE, TIME_END AS payTime
FROM tb_wxpay_order_business
WHERE DEL_FLAG = 0 AND IS_VALID = 0
) `b` ON a.aggtegateRequestCode = b.AGGTEGATE_REQUEST_CODE
WHERE 1 = 1