S
SQL Learner
Hi All,
How can I UPDATE table using partial word match?
How can I write a SQL statement in ACCESS to do so? (I am using
MS-Access 2003.)
The two tables and the expected result are listed below:
Thank you in advance!
- Grasshopper -
=======================================================
TABLE: tblStreet_Value (Table to be updated)
Street Value2
--------------- ------
123 ABC Street
124 ABC Street
125 ABC Street
1 XYZ AVE
2 XYZ AVE
3 XYZ AVE
10 CBS Street
11 CBS Street
12 CBS Street
100 Apple Road
101 Apple Road
102 Apple Road
TABLE: TblWord_Number
Word Number Value
---- ------ -----
ABC 123 NY
ABC 125 CA
CBS 11 MA
CBS 12 TX
Expected Result
Street Value2
--------------- ------
123 ABC Street NY
124 ABC Street
125 ABC Street CA
1 XYZ AVE
2 XYZ AVE
3 XYZ AVE
10 CBS Street
11 CBS Street MA
12 CBS Street TX
100 Apple Road
101 Apple Road
102 Apple Road
====================
A side note:
Alex Kuznetsov has provided me a partial match solution for SQL Server:
SELECT t.* FROM tblStreet t WHERE EXISTS(SELECT 1 FROM tblWord w WHERE
t.Street LIKE '%'+Word+'%')
How can I UPDATE table using partial word match?
How can I write a SQL statement in ACCESS to do so? (I am using
MS-Access 2003.)
The two tables and the expected result are listed below:
Thank you in advance!
- Grasshopper -
=======================================================
TABLE: tblStreet_Value (Table to be updated)
Street Value2
--------------- ------
123 ABC Street
124 ABC Street
125 ABC Street
1 XYZ AVE
2 XYZ AVE
3 XYZ AVE
10 CBS Street
11 CBS Street
12 CBS Street
100 Apple Road
101 Apple Road
102 Apple Road
TABLE: TblWord_Number
Word Number Value
---- ------ -----
ABC 123 NY
ABC 125 CA
CBS 11 MA
CBS 12 TX
Expected Result
Street Value2
--------------- ------
123 ABC Street NY
124 ABC Street
125 ABC Street CA
1 XYZ AVE
2 XYZ AVE
3 XYZ AVE
10 CBS Street
11 CBS Street MA
12 CBS Street TX
100 Apple Road
101 Apple Road
102 Apple Road
====================
A side note:
Alex Kuznetsov has provided me a partial match solution for SQL Server:
SELECT t.* FROM tblStreet t WHERE EXISTS(SELECT 1 FROM tblWord w WHERE
t.Street LIKE '%'+Word+'%')