J
jamesfreddyc
Ok, so I have acquired a database that needs some work and I am looking for
some help. Not much thought went into the db design, so I am trying to do it
after-the-fact.
Anyway.... I am attempting to assign Table1's "Loc_AssetID" to Table2's
AssetID where Table1 and Table2 PkID's match. If you notice in my example
below, there might be 3 PkID's = 6 in Table1 while there are 2 PkID's in
Table2 (Many-To-Many).
Table1
Loc_AssetID PKID
17750 6
17751 7
17752 8
18007 6
18008 6
Table2
AssetID PkID
6
6
7
8
I tried an UPDATE query on Table2 to test to see what would happen. The SQL
below assigned Loc_AssetID 18008 to all 2 matching records in Table2.
UPDATE INSPECTIONS LEFT JOIN ASSETS_INSPECTIONS ON INSPECTIONS.PKID =
ASSETS_INSPECTIONS.PKID SET INSPECTIONS.ASSETID =
[ASSETS_INSPECTIONS].[LOC_ASSETID]
WHERE (((INSPECTIONS.PKID)=6));
The whole point to my exercise here is to be able to perform a 1-to-many
relationship between the two. The problem I have now is that it's a
many-to-many without any way to build a junction table. Or is there a way to
do this after the fact?
Thanks for any help/input!!!
j
some help. Not much thought went into the db design, so I am trying to do it
after-the-fact.
Anyway.... I am attempting to assign Table1's "Loc_AssetID" to Table2's
AssetID where Table1 and Table2 PkID's match. If you notice in my example
below, there might be 3 PkID's = 6 in Table1 while there are 2 PkID's in
Table2 (Many-To-Many).
Table1
Loc_AssetID PKID
17750 6
17751 7
17752 8
18007 6
18008 6
Table2
AssetID PkID
6
6
7
8
I tried an UPDATE query on Table2 to test to see what would happen. The SQL
below assigned Loc_AssetID 18008 to all 2 matching records in Table2.
UPDATE INSPECTIONS LEFT JOIN ASSETS_INSPECTIONS ON INSPECTIONS.PKID =
ASSETS_INSPECTIONS.PKID SET INSPECTIONS.ASSETID =
[ASSETS_INSPECTIONS].[LOC_ASSETID]
WHERE (((INSPECTIONS.PKID)=6));
The whole point to my exercise here is to be able to perform a 1-to-many
relationship between the two. The problem I have now is that it's a
many-to-many without any way to build a junction table. Or is there a way to
do this after the fact?
Thanks for any help/input!!!
j