SQL-查询单表某字段大于2

SELECT * FROM TGP_ORDER WHERE PAY_TIME IS NOT NULL ORDER BY PAY_TIME DESC  --85309581-6c5d-4395-bac8-9d146585562b

SELECT * FROM TGP_REFUND A,(SELECT TRF.ORDER_ID,COUNT(TRF.ORDER_ID) AS COUNT FROM TGP_REFUND TRF GROUP BY  TRF.ORDER_ID
 HAVING COUNT(TRF.ORDER_ID)>1 ) C
WHERE A.ORDER_ID=C.ORDER_ID AND A.REFUND_ID IN (
SELECT DISTINCT A.REFUND_ID FROM TGP_REFUND_ITEM A,(SELECT TRI.REFUND_ID,COUNT(TRI.REFUND_ID) AS COUNT FROM TGP_REFUND_ITEM TRI 
GROUP BY TRI.REFUND_ID 
HAVING COUNT(TRI.REFUND_ID)>4) C WHERE A.REFUND_ID=C.REFUND_ID)

SELECT DISTINCT A.REFUND_ID FROM TGP_REFUND_ITEM A,(SELECT TRI.REFUND_ID,COUNT(TRI.REFUND_ID) AS COUNT FROM TGP_REFUND_ITEM TRI 
GROUP BY TRI.REFUND_ID 
HAVING COUNT(TRI.REFUND_ID)>4) C WHERE A.REFUND_ID=C.REFUND_ID 

  

posted @ 2022-10-14 16:35  o_osky  阅读(445)  评论(0编辑  收藏  举报