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

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Finding all combination repeated 3 more times

Author  Topic 

latture
Starting Member

24 Posts

Posted - 2013-02-01 : 11:22:30
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.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

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

http://www.sqlservercentral.com/articles/Best+Practices/61537/
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


PS - Columns and Rows not fields and records.. SQL Server is (more or less) a RDBMS.. ;)
Go to Top of Page
   

- Advertisement -