General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Eliminating duplicates with related SQL statement
I create a cursor, joining two tables like this:
SELECT * FROM ChildTable LEFT JOIN ParentTable;
ON ChildTable.Key = ParentTable.Key
It works fine, but I want to eliminate possible duplicate records (with the same key fields) in a ParentTable, because in that case it would be all child records duplicated in a result cursor too.
It's not possible to organize a primary index with no duplicates in a ParentTable, I need just this cursor to be made with this logic.
So, it could be done when I make another cursor from ParentTable:
SELECT * FROM ParentTable group by ParentTable.Key:
into cursor ParentWithoutDuplicates
and join the ChildTable with the new cursor.
But I don't like this way; ParentTable could have large number of records, etc.
Is it a simple way to join two tables and prevent duplicates (as it was in FoxPro 2.6)?
Thank's, Zlatko.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only