Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 remove duplicates from iteration problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Podge
Support Moderator

Ireland
3776 Posts

Posted - 23 March 2010 :  11:32:06  Show Profile  Reply with Quote
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.

Table Name APP.ABC
ID
StringData

Table Name APP.RESULTS
ID
StringData_A_ID
StringData_B_ID
Result

I am iterating over the data comparing each row of StringData to each other row of StringData using the following two SELECT statements;

Outer iteration
SELECT ID, StringData FROM APP.ABC

Inner Iteration
SELECT ID, StringData FROM APP.ABC where ID != " + String_A_ID

String_A_ID & String_B_ID hold the ID's of the Strings to be compared.

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);

AB
12 (String ID 1 compared to String ID 2)
13
14
15
21 (String ID 2 compared to String ID 1)
23
24
25
etc.

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?

Any other ideas ?

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.

Edited by - Podge on 23 March 2010 11:32:37
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.13 seconds. Powered By: Snitz Forums 2000 Version 3.4.07