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 |
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-10-07 : 14:46:57
|
| Hii have table i want to select records where for one variable where there are two distinct valuesthe table is A and i want to select hcpcs that have more than one value the table is like thishcpcs Valuesa 0a 0a 1b 0b 1b 0c 0c 0c 0d 1d 0d 1e 0e 0e 0i want to select records where the value changes within that group by HCPCSso i basically wanthcpcs Valuesa 0a 0a 1b 0b 1b 0d 1d 0d 1THanks |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-10-07 : 14:55:24
|
| SELECT * FROM AWHERE hcpcs IN (SELECT hcpcs FROM A GROUP BY hcpcs HAVING COUNT(DISTINCT Values)>1) |
 |
|
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-10-07 : 15:29:30
|
| Thanks |
 |
|
|
|
|
|