I want one table column to look up data in another column.. and i thought this would work, but it doesn't !
SELECT [LkupDATES].[CINCOMWEEK] FROM LkupDATES WHERE VOLUME.[PRODUCTION DATE]=LkupDATES.myDATE;
LkupDATES and Volume are the tables
cincomweek is the Text field i want to place in the new table column.
production date and myDate are date fields that match to determine what cincomweek to place in the new table.
Steve
data from one table to another.
-
- 4StarLounger
- Posts: 422
- Joined: 04 Feb 2010, 11:46
data from one table to another.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78650
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: data from one table to another.
If it's lookup information, why do you want to store it in a table? That would be redundant. You can retrieve the value at any moment using a query.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 422
- Joined: 04 Feb 2010, 11:46
Re: data from one table to another.
Yes, i know its not optimal to do so. but i just need the one table to contain information from the other table based on the dates.
----------------------------------------------------------------------------------------
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
Owing at LEAST 34 beers to other helpful forum members. Especially HansV!
-
- Administrator
- Posts: 78650
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: data from one table to another.
Then you need an update query:
UPDATE VOLUME INNER JOIN LkupDATES ON VOLUME.[PRODUCTION DATE]=LkupDATES.myDATE SET VOLUME.CINCOMWEEK=LkupDATES.CINCOMWEEK
assuming that the field is named CINCOMWEEK in both tables.
UPDATE VOLUME INNER JOIN LkupDATES ON VOLUME.[PRODUCTION DATE]=LkupDATES.myDATE SET VOLUME.CINCOMWEEK=LkupDATES.CINCOMWEEK
assuming that the field is named CINCOMWEEK in both tables.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12632
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: data from one table to another.
I am curious.Steve_in_Kent wrote:...i just need the one table to contain information from the other table based on the dates.
What is the real underlying "need" here. I would be very surprised if it cannot be met with a different solution that doesn't copy data between tables.
StuartR