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) 

sqlfiddle

output

| attname | title | count_index | --------------------------------- |     red |  boys |           1 | |     red | girls |           2 | 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -