Hi
I have 2 databases with similar tables e.g.
[Forestry].[dbo].[ORIGIN_POINTS] (db1)
FID
Actual_Tonnes_Road_2000
Actual_Tonnes_Sea_2000
[SDE_Forestry].[dbo].[SEFE_ORIGINS] (db2)
ID
telNum
Actual_Tonnes_Road_2000
Actual_Tonnes_Sea_2000
The problem that I have is that I want to get Actual_Tonnes_Road_2000 & Actual_Tonnes_Sea_2000 data from db1 and put it into db2. The 2 tables are related by the fields FID and telNum. Unfortunately FID is unique whereas telNum has multiple entries. I think I need to use something like this:
INSERT INTO [SDE_Forestry].[dbo].[SEFE_ORIGINS]([Actual_Tonnes_Road_2000], [Actual_Tonnes_Sea_2000])
SELECT [Actual_Tonnes_Road_2000], [Actual_Tonnes_Sea_2000] FROM [Forestry].[dbo].[ORIGIN_POINTS]
But I need to fit a where into the statement to match up FID and telNum. Any ideas if this can be done in sql without doing seperate code?
Hope this makes sense.
Cheers
Gary
I have 2 databases with similar tables e.g.
[Forestry].[dbo].[ORIGIN_POINTS] (db1)
FID
Actual_Tonnes_Road_2000
Actual_Tonnes_Sea_2000
[SDE_Forestry].[dbo].[SEFE_ORIGINS] (db2)
ID
telNum
Actual_Tonnes_Road_2000
Actual_Tonnes_Sea_2000
The problem that I have is that I want to get Actual_Tonnes_Road_2000 & Actual_Tonnes_Sea_2000 data from db1 and put it into db2. The 2 tables are related by the fields FID and telNum. Unfortunately FID is unique whereas telNum has multiple entries. I think I need to use something like this:
INSERT INTO [SDE_Forestry].[dbo].[SEFE_ORIGINS]([Actual_Tonnes_Road_2000], [Actual_Tonnes_Sea_2000])
SELECT [Actual_Tonnes_Road_2000], [Actual_Tonnes_Sea_2000] FROM [Forestry].[dbo].[ORIGIN_POINTS]
But I need to fit a where into the statement to match up FID and telNum. Any ideas if this can be done in sql without doing seperate code?
Hope this makes sense.
Cheers
Gary