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 |
|
mfriedman81
Starting Member
2 Posts |
Posted - 2004-11-17 : 10:22:56
|
| I have a dataset that has invoice data, but the invoice numbers are not unique. I think that a combination of the inovice number and several other variables might create a unique id. In order to test this hypothesis I triedselect count(disntict fieldA, fieldB, etc) from tableBut that did not work. I then triedSelect Field A, FieldB, Count(1)from table where count(1)>1Group by Field A, Field BAnd that also did not work. Any ideas? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2004-11-17 : 10:52:21
|
trySelect FieldA, FieldB, count(cast(FieldA as varchar(100)) + cast(FieldB as varchar(100)))from table Group by Field A, Field Bhaving count(cast(FieldA as varchar(100)) + cast(FieldB as varchar(100))) > 1Go with the flow & have fun! Else fight the flow |
 |
|
|
mfriedman81
Starting Member
2 Posts |
Posted - 2004-11-17 : 11:10:02
|
| Thanks, I just should have used having instead of where and put it after the group by. I think that will work. Thanks for your help as I am pretty new to SQL |
 |
|
|
|
|
|