use TaiYuan_Lynn

SELECT '"http://127.0.0.1:9902/customer/m-mall/query-order-pay-status?orderId='+cast(A.FOrderId AS VARCHAR) 
+'&token='+CAST(B.FToken AS VARCHAR)+ '",'
FROM TMallOrder AS A,(
SELECT A.FPersonId,A.FToken
FROM TLoginSession AS A,(
SELECT FPersonId,MAX(FCreateTime) AS FCreateTime FROM TLoginSession ts 
WHERE FPersonType  = 'Customer'
GROUP BY FPersonId ) AS B
WHERE A.FPersonId  = B.FPersonId
AND A.FCreateTime  = B.FCreateTime) AS B
WHERE A.FCustId = B.FPersonId

AND A.FOrderStatus = 'PAYING'
AND A.FCreateTime > '2021-11-10'
AND A.fpaywechattradeno IN(SELECT merchant_order_id FROM wechat_order)


SELECT * FROM wechat_order
WHERE merchant_order_id not in(select fpaywechattradeno from TMallOrder)
ORDER BY trade_time DESC 


SELECT merchant_order_id from wechat_order
group by merchant_order_id
having sum(1) > 1

SELECT * FROM TMallOrder to2 
WHERE fpaywechattradeno IN(SELECT merchant_order_id FROM wechat_order)
AND FOrderStatus NOT IN('WaitConfirm')

delete wechat_order


SELECT * FROM TMallOrder WHERE FOrderId = 5382906098952052204

UPDATE TMallOrder SET FPayWeChatTradeNo  = 'c9361aba9bd4a4110bbf4bf8cd2641dc' where FOrderId  = 5382906098952052204

