Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete records where 2 col are the same
Message
De
25/09/2017 13:23:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01654526
Message ID:
01654543
Vues:
46
Try
SELECT * FROM myCursor WHERE id  in (SELECT id FROM myCursor GROUP BY 1 HAVING COUNT(distinct category) > 1)
>Hi,
>
>Here is another Sunday challenge I am trying to resolve. Here is a simplified case, but close to what I am trying to do.
>
>Table has the following 2 columns/fields, sorted by ID, and the values as shown below:
>
>
>ID                 CATEGORY
>0001             ABC
>0002             NBC
>0002             NBC
>0002             NBC
>0003             CBS
>0004             123
>0004              ABC
>0005             567
>0005             567
>0006             009
>0006             123
>0006             123
>
>I want to delete all records where the ID and CATEGORY are matching, it does not matter 1 records or more. So the recult would be as follows:
>
>ID                 CATEGORY
>0004             123
>0004              ABC
>0006             009
>0006             123
>0006             123
>
>
>Because at least one of the records in the group by ID is not matching column CATEGORY.
>
>Can this be done?
>
>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform