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 |
|
Ex
Posting Yak Master
166 Posts |
Posted - 2006-03-30 : 17:41:00
|
| Hi all,I was given a access database trying to find the duplicates just want to make sure my queries are correct.Ok so we have the columnslast Name, first Name , initial, title with name tblContactsFirst i wanted to check for exact duplicatesused this queryselect [last Name], [first Name],Initial, title, count(*)from tblContacts group by [last Name], [first Name],Initial, titleHaving (count(*)> 1)think that one is oknext i wanted to check if one of the columns are out this is kinda where i am not sure i tried with just the title select tb1.[last Name], tb1.[first Name],tb1.Initial, tb1.titlefrom tblContacts tb1 join tblContacts tb2 ontb1.[last Name] = tb2.[last Name] andtb1.[first Name] = tb2.[first Name] andtb1.Initial = tb2.Initialand tb1.title <> tb2.titlegroup by tb1.[last Name],tb1.[first Name],tb1.Initial, tb1.titlenot exactly sure the correct sql for this, i am sure this query is not 100% though------------------------------------------------------------------sp2 for IE is FIREFOX !! |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-03-30 : 22:59:47
|
| Ex, You shouldn't need to join like this. Presumably this is the second step in the process which finds near hits. Why don't you just run the first query but leave out [Title]? This should give you similar results, but it will also include total matches. I'd be inclined to run them sequentially:a: Number exact matches = 5b: Number matches (excluding title) = 8 (which is 5 exact matches and 3 without title)etc etcIt will also be easier to maintain than what you're trying to do.HTH,Tim |
 |
|
|
|
|
|
|
|