NO****@comcast.net (Tony V) wrote in
news:98*******************@216.196.97.136:
Hello
I have 2 tables:
table1
CODE | PRICE
1234 | 20
234 | 10
table2
CODE | PRICE
1234a |
1234b |
1234c |
234a |
234b |
234c |
234d |
WHat I need to do is, compare the string for CODE in table 1
against what is found in table2. The relationship is always
the same in that table2.code is always what is found in table1
plus one more character. SO I need to update table2 based on
that so the result is:
1234a | 20
1234b | 20
1234c | 20
234a | 10
234b | 10
234c | 10
234d | 10
I'm kind of a n00b, but I need to use the MID function
perhaps? Any help greatly appreciated.
You would be better off using the LIKE operator.
Practice this on a copy of the database to make sure you get it
working correctly
Create a new query. Add both tables. Double click on each of the
table 2 fields to move them into the lower panel of the query
builder.
Put this in the Criteria row for the code column:
Like [table1].[code] & "*"
the * says to match any character.
Change the query to an update query.
Put this in the Update To: row of the Price column:
[table1].[price]
Note: If you have 123a and 1234a and 12345a these will all match
123 from table 1. You will need to try something like
Like [table1].[code] & "[A-Z]*"
the [A-Z] says only match characters in the range from A to Z.
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account from http://www.teranews.com