Difference beetween two tables with the same structure

  • Thread starter Thread starter claudio.blundo
  • Start date Start date
C

claudio.blundo

Hi,

i got two tables, same structure table "028 - des" and table "028 -
prg".The table "028 - prg" is in my databese application but the "028
- des" is the newest.I can't replace table "028 - prg" with "028 -
des" 'cause in any case i need to modify other stuff.i have to find
difference beetwen the tables.

There are in the two tables the same names of the fields an structure
and you can see it on the attachments.

1)the problem is that i don't know how manage a multifields with multi
records beetween two tables like this
2)how can i find differents records between, i wanna intercept the
records from "028 - prg" <> "028 - des" and replace them.

Thks in advance

table "028 - des"
Fields:danno, data, bene and impo

0281997004047 06051999 D'AMBROSIO
SERGIO
638,86
0281997004047 26041999 D'AMBROSIO
SERGIO
1.932,08
0281997008654 31031998 BARBATO
MARIA
1.337,22
0281997008654 20031998 BARBATO
MARIA
1.058,74
0281997008655 09071999 FORTUNATO
RAIMONDO
2.019,35
0281997008655 04011999 FORTUNATO
RAIMONDO
1.688,29
 
hi Claudio,

i got two tables, same structure table "028 - des" and table "028 -
prg".The table "028 - prg" is in my databese application but the "028
- des" is the newest.I can't replace table "028 - prg" with "028 -
des" 'cause in any case i need to modify other stuff.i have to find
difference beetwen the tables.
What are you trying to achieve?
There are in the two tables the same names of the fields an structure
and you can see it on the attachments.
1)the problem is that i don't know how manage a multifields with multi
records beetween two tables like this
What do you mean?
2)how can i find differents records between, i wanna intercept the
records from "028 - prg" <> "028 - des" and replace them.
Use a INNER JOIN on your primary key fields and compare the non key fields.
table "028 - des"
Fields:danno, data, bene and impo

0281997004047 06051999 D'AMBROSIO
SERGIO
638,86
0281997004047 26041999 D'AMBROSIO
SERGIO
1.932,08
Looks like [danno] and [data] may be a candidate key, then your query
SQL may look like this:

SELECT
T1.[danno], T1.[data],
T1.[bene], T2.[bene],
T1.[impo], T2.[impo]
FROM [028 - prg] T1
INNER JOIN [028 - des] T2
ON (T1.[danno] = T2.[danno]) AND (T1.[data] = T2.[data])
WHERE (T1.[bene] <> T2.[bene]) OR (T1.[impo] <> T2.[impo])

btw, consider using table names without spaces and special characters
like '-'.


mfG
--> stefan <--
 
Back
Top