I have following structure:
TradeNo | OrderNo | Buy_Sell |
1001 2001 Buy
1002 2002 Buy
1001 2001 Sell
In this particular structure I wanted to find out double records of unique combinations of TradeNo and OrderNo.
I tried the following query:
SELECT t1.tradeno,
t1.orderno,
t2.tradeno,
t2.orderno,
t1.Buy_sell,
t2.Buy_sell
FROM tradeFile t1,
tradeFile t2
WHERE t1.TradeNo=t2.TradeNo
AND t1.Orderno=t2.orderno
This query , return me two copies of single records. But i wanted to have repeated records finding. Like in above table the first and second record is repeated with unique combination of tradeno and orderno as [1001 and 2001].
Please help me out.
select TradeNo, OrderNo
from TradeFile
group by TradeNo, OrderNo
having count(*) > 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.