Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Avoiding duplicates
Message
From
01/04/2009 09:25:50
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01392542
Message ID:
01392561
Views:
54
Hello Sergey,

Million thanks ... it works as a charm!

Pat
>You want the first record in the ID order for the same Ref, right? Try
>
>SELECT * FROM myatble mt1 ;
>	WHERE NOT EXISTS (SELECT 1 FROM mytable WHERE ref = mt1.ref AND id < mt1.id)
>
>>
>>Can someone help me find the correct syntax of a SQL statement would eliminate the duplicates?
>>
>>I have a table: 'mytable'. It has 3 fields: ID, NAME and REF
>>
>>ID | NAME | REF
>>1 | Dupuis | 200817 *
>>2 | Durand | 200817
>>3 | Michiels | 200818 *
>>4 | Dulome | 200819
>>5 | Pernut | 200820 *
>>6 | Bloquier | 200820
>>7 | Moureau | 200820
>>8 | Pirotte | 200821 *
>>9 | Marchand | 200821
>>
>>
>>I would like the SQL statement to return only the records that are tagged (all fields).
>>
>>How can I do this?
>>
>>Thanks to all,
>>Pat
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform