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.
| Author |
Topic |
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2012-02-11 : 08:30:51
|
| hi team , i have a table in my database like : id vid amt remarks 1 111 50 a 2 111 50 c 3 111 60 ss 4 112 40 dd 5 112 40 cc 6 112 80 dd 7 112 90 dd then i need to get records from this table that only rows from table is get selected where vid and amt col values are same.challenge everything |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-11 : 08:34:37
|
you mean this?SELECT columns...FROM(SELECT *,COUNT(1) OVER (PARTITION BY vid,amt) AS CntFROM table)tWHERE Cnt >1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2012-02-11 : 09:20:06
|
| yes exactly , thanks a lotchallenge everything |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-11 : 09:21:16
|
| welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|