update statement

G

Guest

I am getting syntax error for the following update statement

update post set a.edate=b.edate from
post as a, temp as b where a.id=b.id and a.edate='20011231'

I get syntax error after b.edate.

Here is what I intend doing -
There are two tables post and temp both with id as part of key.

I want to update table post with date from table temp only for the record in
post where id matches id in table temp and the edate = '20011231' and not any
other record with the same id.

eg. post data is
id edate
1 1/1/1991
1 2/1/1992
1 12/31/2001
2 3/15/1990
2 12/31/2001
temp data is
1 2/1/2001
2 1/12/1999

Can someone help me in fixing this problem.
Thank you for your help in advance!
-Me
 
G

Guest

If your [edate] field is stored as a date, as it appears to be in your
example, try:

update post
set a.edate=b.edate
from post as a, temp as b
where a.id=b.id and a.edate=#12/31/2001#

Or you might try:

update post
set a.edate=b.edate
from post as a
INNER JOIN temp as b
ON a.id=b.id
WHERE a.edate=#12/31/2001#


HTH
Dale
 
G

Guest

hi,

UPDATE post INNER JOIN Temp ON post.ID = Temp.ID SET post.e_date =
[temp].[e_date]
WHERE (((post.e_date)=#12/31/2001#));

if i understood, your steps will;
1. Relation with 2 table, ID on ID
2. Insert ID and Date fields of Post table,
3. Criteria for Date; 12/31/2001
4. Update to : Temp.e_date

i made an example, if you want the example; write me please;
(e-mail address removed)

Best Regards
 
G

Guest

Hi Dale,

Thanks for the reply! However, I tried using both options listed by you, it
still doesn't work for me.

I am really frustrated now!!!

Will appreciate if you could point me to something else.

-Me

Dale Fye said:
If your [edate] field is stored as a date, as it appears to be in your
example, try:

update post
set a.edate=b.edate
from post as a, temp as b
where a.id=b.id and a.edate=#12/31/2001#

Or you might try:

update post
set a.edate=b.edate
from post as a
INNER JOIN temp as b
ON a.id=b.id
WHERE a.edate=#12/31/2001#


HTH
Dale


--
Email address is not valid.
Please reply to newsgroup only.


Me said:
I am getting syntax error for the following update statement

update post set a.edate=b.edate from
post as a, temp as b where a.id=b.id and a.edate='20011231'

I get syntax error after b.edate.

Here is what I intend doing -
There are two tables post and temp both with id as part of key.

I want to update table post with date from table temp only for the record in
post where id matches id in table temp and the edate = '20011231' and not any
other record with the same id.

eg. post data is
id edate
1 1/1/1991
1 2/1/1992
1 12/31/2001
2 3/15/1990
2 12/31/2001
temp data is
1 2/1/2001
2 1/12/1999

Can someone help me in fixing this problem.
Thank you for your help in advance!
-Me
 
G

Guest

Hello Ozcan,

Thanks for the reply!

Your suggestion worked for me!

Appreciate your help
-Me

Özcan ELMALI said:
hi,

UPDATE post INNER JOIN Temp ON post.ID = Temp.ID SET post.e_date =
[temp].[e_date]
WHERE (((post.e_date)=#12/31/2001#));

if i understood, your steps will;
1. Relation with 2 table, ID on ID
2. Insert ID and Date fields of Post table,
3. Criteria for Date; 12/31/2001
4. Update to : Temp.e_date

i made an example, if you want the example; write me please;
(e-mail address removed)

Best Regards
Me said:
I am getting syntax error for the following update statement

update post set a.edate=b.edate from
post as a, temp as b where a.id=b.id and a.edate='20011231'

I get syntax error after b.edate.

Here is what I intend doing -
There are two tables post and temp both with id as part of key.

I want to update table post with date from table temp only for the record in
post where id matches id in table temp and the edate = '20011231' and not any
other record with the same id.

eg. post data is
id edate
1 1/1/1991
1 2/1/1992
1 12/31/2001
2 3/15/1990
2 12/31/2001
temp data is
1 2/1/2001
2 1/12/1999

Can someone help me in fixing this problem.
Thank you for your help in advance!
-Me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top