Ramaq
Ramaq

Reputation: 33

join over two tables

I have two tables (T1 and T2).

      shop    land
------------------
 1    F24UK   UK
 2    MDUK    UK
 3    RDAUK   UK
 4    EDOUK   UK
 5    RDUK    UK
 6    TIUK    UK


      shop    land   customertype
---------------------------------
 1    RDUK    GB     B2C
 2    RDUK    GB     B2C
 3    MDUK    GB     B2C
 4    MDUK    GB     B2C

I want to join over column 'land'. But broblem is in t2 i have GB instead of UK. How can i solve this issue optimally?

Thanks

Upvotes: 0

Views: 33

Answers (1)

Tab Alleman
Tab Alleman

Reputation: 31785

You can use a CASE expression:

t1.land=CASE WHEN t2.land='GB' THEN 'UK' ELSE t2.land END

Upvotes: 2

Related Questions