sql server - TSQL, Remove rows based upon Row-Index -
my table this.....
**attname** **title** **count_index** red boys 1 red girls 2 green boys 1 blue boys 1
i want return...
red boys 1 red girls 2
thats because have red 2 entries, want skip/remove row(s) if count 1. in other words interested in rows if count goes above "1".
try
select * table1 attname in (select attname table1 group attname having count(*) > 1)
output
| attname | title | count_index | --------------------------------- | red | boys | 1 | | red | girls | 2 |
Comments
Post a Comment