TSQL, Remove rows based upon Row-Index

My Table is like this.....


**AttName**     **Title**        **Count_Index**

Red                Boys              1
Red                Girls             2
Green              Boys              1
Blue               Boys              1

I only Want to return...

Red  Boys        1
Red  Girls       2

Thats because I have Red with two entries, I want to skip/remove all the ROW(s) if their Count is ONLY 1. In other words I am only interested in rows if their count goes above "1".

Answers


Try

SELECT * 
  FROM table1
 WHERE AttName IN (SELECT AttName FROM table1 GROUP BY AttName HAVING COUNT(*) > 1)

SQLFiddle

Output

| ATTNAME | TITLE | COUNT_INDEX |
---------------------------------
|     Red |  Boys |           1 |
|     Red | Girls |           2 |

Need Your Help

JLabel is not repainting

java swing

I am doing an animator showing a series of .jpg. The animator is a thread which is running as it is updating the other JLabel which I use to display text. But it just will not repaint the ImageIcon...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.