Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete extra rows
Message
 
 
À
26/03/2008 14:35:37
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01305862
Message ID:
01305870
Vues:
7
>Hi All,
>
>I need your help again..
>
>What I need to do in SSMS
>
>•I have to compare 2 tables (inMast – Part table, inCros – Cross Reference)
>•Delete the extra rows from Cross Reference (inCros) which doesn’t exit in Part table (inMast)
>
>
>Although I’m working on a test database I’m little concern on deleting data . So I just did a Select statement to see all matching records in both tables.
>
>Could one of you please guide me here? How to delete the extras from incros ???
>
>This is my select statement..
>
>SELECT incros.fpartno, incros.fcpartrev
>   FROM  incros
>      Inner JOIN
>         inmast
>      ON UPPER(incros.fpartno) + UPPER(incros.fcpartrev) = UPPER(inmast.fpartno) + UPPER(inmast.frev)
>              AND UPPER(incros.fnumber) = UPPER(inmast.custno1)
>              AND UPPER(incros.fcrosspart) = UPPER(inmast.cpartno1)
>   WHERE (incros.fctype = 'C')
>
>TIA
>
>- Jeana -

Does the select work correctly?

If yes, then

delete Incros from Incros Inner JOIN (your select goes here).

See also Re: SQL to purge old orders and customers Thread #1162715 Message #1162913

BTW, if this is SQL Server, why do you need UPPER() ?
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform