I have two tables in a database. The first contains rows of string data that I want to compare against itself. The second stores the results.
I am iterating over the data comparing each row of StringData to each other row of StringData using the following two SELECT statements;
SELECT ID, StringData FROM APP.ABC
SELECT ID, StringData FROM APP.ABC where ID != " + String_A_ID
Strings are not compared to themselves because of the second SELECT statement above however I think I can halve the amount of processing necessary if I can remove duplicate comparisons. These are ID's for sample results (with the actual result removed);
The two lines in red above are duplicates of each other and I only need the first one. How can I prevent the second comparison using a join on the RESULTS table in either of the SELECT statements above?