I found the following link:
It provides an intriguing way to remove duplicates from a database. It works fine in SQL2000 query manager. However, in FoxPro 6,7 and 8 it fails with in the following way.
Here is my example.
I have the following table named contacts:
id name phone
10 john smith 4048231234
11 john smith 4048231234
12 john smith 4048231234
20 jane doe 5155562432
30 jack brown 8082593353
31 jack brown 8082593353
I want:
id name phone
12 john smith 4048231234
20 jane doe 5155562432
31 jack brown 8082593353
Following the webpage instructions I create the SQL statement:
SELECT * from contacts WHERE exists(select null FROM contactsb WHERE b.phone = contacts.phone GROUP BY l_phone HAVING contacts.id < MAX(b.id)) )
In theory, I should have a result:
id name phone
10 john smith 4048231234
11 john smith 4048231234
20 jane doe 5155562432
30 jack brown 8082593353
In reality I get:
"SQL: cannot determine datatype of SQL column: uay"
When I change 'null' to '*' I get:
"SQL: GROUP BY clause is missing or invalid"
at this point I am scratching my head. I have verified that all of the commands in the query are valid. FoxPro simply will not parse this statement and I cannot figure out why.
I just cannot seem to make it work.
It provides an intriguing way to remove duplicates from a database. It works fine in SQL2000 query manager. However, in FoxPro 6,7 and 8 it fails with in the following way.
Here is my example.
I have the following table named contacts:
id name phone
10 john smith 4048231234
11 john smith 4048231234
12 john smith 4048231234
20 jane doe 5155562432
30 jack brown 8082593353
31 jack brown 8082593353
I want:
id name phone
12 john smith 4048231234
20 jane doe 5155562432
31 jack brown 8082593353
Following the webpage instructions I create the SQL statement:
SELECT * from contacts WHERE exists(select null FROM contactsb WHERE b.phone = contacts.phone GROUP BY l_phone HAVING contacts.id < MAX(b.id)) )
In theory, I should have a result:
id name phone
10 john smith 4048231234
11 john smith 4048231234
20 jane doe 5155562432
30 jack brown 8082593353
In reality I get:
"SQL: cannot determine datatype of SQL column: uay"
When I change 'null' to '*' I get:
"SQL: GROUP BY clause is missing or invalid"
at this point I am scratching my head. I have verified that all of the commands in the query are valid. FoxPro simply will not parse this statement and I cannot figure out why.
I just cannot seem to make it work.