Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Finding all combination repeated 3 more times
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

24 Posts

Posted - 02/01/2013 :  11:22:30  Show Profile  Reply with Quote
Sorry, I'm new and if I make post this incorrectly please let me know and I will fix it.

I'm using sql server 2008.

I need help trying to find a way to locate all possible combination in a field that's repeated 3 more times by designated number. For example for like the word DOG. I need to see all combination as in DOG, DO, DG, OD, OG, GOD, OGD, ODG, DGO, etc if there are others. I have field that would have records like d, o, g which I'm thinking about stringing them.

So each d, o, and g would also have specific numbers assigned to them as their identifier such as 1001. As such if we call the field with the identifiers as field1 and fields with letter like 'd' field2 then for every field1 there would be field2. Of course 1001 for field1 could have more than one field2 data as I explained so 1001,d - 1001,o - 1001,g and so on.

If a field1 has more than 1 instances of field2 and that same combination of data in field2 shows up more than 3 or more times with any field1 data then I need to be able to see it.

Does this all make sense? I feel like I'm just talking out of my butt...

Anyway, if anyone can help that would be great. Thanks in advance.

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 02/01/2013 :  12:03:40  Show Profile  Reply with Quote
I'm not sure I follow your scenario. Can you post some sample data and expected output?

PS - Columns and Rows not fields and records.. SQL Server is (more or less) a RDBMS.. ;)
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000