|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How do I clenup duplicate record with a query
I have a query that is giving me results from table1.name = table2.name and table1.name=table3.name. Table1 is the main table 1 is the main table with all names in the company in it. Table 2 has only certain names in it and Table 3 only has some names in it. I need the names that match from table2 and table3 but I need to fine a way to cleanup duplicate names in the same query. If the name is in Table2 and Table3 I get to instances of the name. I only want to see on instance of the name. Can some one help me.
Thanks in Advance |
|
#2
|
||||
|
||||
|
have you tried SELECT DISTINCT?
otherwise, perhaps show us some small sample data... i know i'm kind of confused with your description =) |
|
#3
|
|||
|
|||
|
if distinct dosent work
You may need to group your results.
select table1.code,table2.name from table1, table2 where table1.code=table2.code group by table1.code. This would apply when a code has more than one name. select distinct table1.code,table2.name from table1, table2 where table1.code=table2.code group by table1.code. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > How do I clenup duplicate record with a query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|