Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a table of articles where the same article may be presented to different audiences with slightly altered text depending on the user's access level. When this occurs, the article will have the same title, subtitle, and sub-subtitle but different ID's. For the past several years, these articles were not related in the DB, however a redesign on the website now makes creating these relationships necessary. The only way I have to join them together is by the title, subtitle, and sub-subtitle.

I can create a pair of temporary tables and join them, but I get exactly double the needed records.

If I add another record that has the same title, subtitle, and sub-subtitle
INSERT INTO Product1 (ProductID, Title, SubTitle, SubSubTitle) VALUES (8, "No Idea", "Where I am right now", "");
The Cartesian join table now has 10 records when I only want 4.

ProductID1 | ProductID2 | Title | SubTitle | SubSubTitle
3 | 4 | Big Ideas | Where they come from | Interwebs
4 | 3 | Big Ideas | Where they come from | Interwebs
1 | 2 | Big Ideas | Where they come from | Stackexchange
2 | 1 | Big Ideas | Where they come from | Stackexchange
6 | 7 | No Idea | Where I am right now |
6 | 8 | No Idea | Where I am right now |
7 | 6 | No Idea | Where I am right now |
7 | 8 | No Idea | Where I am right now |
8 | 6 | No Idea | Where I am right now |
8 | 7 | No Idea | Where I am right now |

The order of the ProductIDs doesn't matter. How would I limit the results to only those records I need? Is there a better way to do this?

The base table is a list of articles. I created a temporary table to reduce the stress on the live table. If three records are related, (e.g. 6,7, & 8), I want 6-7, 6-8, and 7-8 join in the table. If I SELECT MIN(ProductID) ...; then I only end up with a 6-7 and 6-8 join.
–
JustinOct 17 '13 at 20:30

Can you edit the question and add the result you want?
–
ypercubeOct 17 '13 at 20:35