>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 #
1162913BTW, if this is SQL Server, why do you need UPPER() ?
If it's not broken, fix it until it is.
My Blog