sql server - SQL union for one identical column -


i have sql table translation of website :

translate

  • id : xxx.xxx.xxxx.xxxx
  • label : lbl_name
  • translate : name
  • language : english

i'm trying give users custom translation, users can set 1 or more labels have :

  • id : xxx.xxx.xxxx.xxxx
  • label: lbl_name
  • translate : n4m3
  • language : englishcustom

i want select translate languague = "english"

then select translate languague = "englishcustom"

and union name's column. if have identical name (here: lbl_name), give priority on englishcustom "n4m3", not "name".

i want understand how can doing : if have 2 identical label, user added trad on label, translate on englishcustom , not on english, sql request

can me please ? thank

if got query ready , need return right values might want have coalesce()

lets assume query (just eyplain, might not work):

select coalesce(t2.translate,t1.translate) translate t1   left join translate t2          on t1.label = t2.label         , t2.languague = concat (t1.languague,'custom') t1.languague = 'english' 

coalesce return first non null value. if left join not join custom name default returned.

in pastebin did quick test mysql table should work you.


Comments

Popular posts from this blog

javascript - WinJS appendTextAsync producing scheduler errors -

minify - Minimizing css files -

Sockets with kotlin -