sql - select clause evaluates and return value from different columns of joined tables -


i'm pretty sure question answered before cannot search properly. please support.

my question following:

i have 2 tables(a+b) joined. put condition in select clause return value column - either or b based on specific value evaluate.

for example

select a.id, a.country, case city when a.city '%york' "value a.city" else value b.town end a, b a.id=b.id

thanks in advance

your pseudo code pretty close

select a.id,        a.country,        case            when a.city '%york' a.city            else b.town        end location join b on a.id=b.id 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -