Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate records

Status
Not open for further replies.

simma

Programmer
Sep 11, 2001
398
US
Hello
How do I eliminate duplicates?c1 is id and rest of date fields are from different tables.
Thanx
c1 c2 c3 c4 c5
1000041782 2002-06-27 NULL 2002-03-27 NULL
1000048674 2002-05-01 2002-05-07 2002-05-08 NULL
1000049668 2002-06-17 NULL NULL nULL
1000049770 2002-04-08 NULL NUL NULL
1000050204 2002-01-15 2002-01-17 2002-02-19 NULL
1000050204 2002-03-17 2002-03-18 2002-02-19 NULL
1000050204 2002-06-04 NULL 2002-02-19 NULL
1000050204 2002-06-04 NULL 2002-05-15 2002-05-20
 
It is hard to tell the problem from the data alone. A copy of the query would help however I recommend checking the joins to other tables.
You have to put conditions in the query to filter records from each table. Using aliases helps as well.

For example;
Select t1.c1,
t2.c2,
t2.c3,
t3.c4,
t3.c5
From table1 as t1
join table2 as t2 on (t2.columnX = t1.columnY)
join table3 as t3 on (t3.columnA = t2(0r t1).columnB)
Where table1 condition
and table2 condition
and table3 condition;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top