Hi, We have an old SQL query written for Oracle. I am trying to understand the query and replicate it in Alteryx but having difficulty understanding the need for sub queries. Any help in rewriting these queries using the ANSI92 syntax or rewriting in Alteryx is appreciated.
Here is how the query looks. Both the header and lines table have about 1.5 million rows. All fields used in the query are of type varchar.
SELECT a.*, b.*
FROM header a, lines b
WHERE a.id = (SELECT MIN(a1.id) FROM header a1 WHERE a1.company = a.company AND a1.docnumber = a.docnumber)
AND a.company = b.company AND a.docnumber = b.docnumber
AND b.id = (SELECT MIN(b1.id) FROM lines b1 WHERE a.company = b1.company AND a.docnumber = b1.docnumber)