I have 4 street addresses in a table called addr:
123 MAIN ST
123 N MAIN ST
123 S MAIN ST
123 E MAIN ST
The addr table has two cols: addr & dir
the addr col contains the address and the dir col is empty (its the col I want to update)
I have 4 street directions in a table called dir:
N
S
E
W
The dir table has a single col called dir (short for direction).
I could write 4 separate queries based on:
UPDATE addr SET dir=‘N’ WHERE addr LIKE ‘% N %’
Is there a way to do it in one query? If so how?
EDIT:
tried:
UPDATE addr, dir SET addr.dir = dir.dir WHERE addr.addr LIKE ‘% dir.dir %’