Mysql : display one field or another conditionally -


i have 2 tables :

table_in_french
- french_value

table_translated_value
- french_value
- spanish_value

i need browse table_in_french , display linked spanish value if exists or french value if there no translation available.

i have tried :

select (case when (t1.french_value = t2.french_value) spanish_value else t1.french_value end) label table_in_french t1, table_translated_value t2; 

but getting many duplicates values.

thanks in advance

try query:     select (case when (t1.french_value = t2.french_value) spanish_value else t1.french_value end) label table_in_french t1 right join table_translated_value t2 on t1.french_value = t2.french_value; 

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 -