We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- SQL
- Advanced Join
- Symmetric Pairs
- Discussions
Symmetric Pairs
Symmetric Pairs
Sort by
recency
|
1302 Discussions
|
Please Login in order to post a comment
select f1.x, f1.y from Functions f1 join Functions f2 on f1.x = f2.y and f1.y = f2.x where f1.x <= f1.y and f1.rowid != f2.rowid group by f1.x, f1.y order by f1.x, f1.y ;
SQL Server
SELECT MINX, MAXY FROM (SELECT MIN(X) AS MINX, MAX(Y) AS MAXY, X+Y AS SUMXY, ABS(X-Y) AS DIFF, COUNT(X) AS COUNTX FROM FUNCTIONS GROUP BY SUMXY, DIFF HAVING COUNTX = 2 ORDER BY MINX) SUB
The website is showing an error in the code, but when I run the same test cases on my local machine using the MySQL application, it works fine. If anyone can help me understand the reason for this discrepancy, it would be greatly appreciated.