Skip to content
Advertisement

MySQL tree structure

Hello i am trying to prepare tree structure with MySql, tables look something like this.

My Question is:

  1. Is it possible to do left join and sort columns by name, but if in lang is eq to “fra” return that row with that name, otherwise return “eng” name.

Pseudo code

So final result will be something like this, in total “fra” lang has priority, and all result should be sorted by name.

Advertisement

Answer

this should work, give it a try:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement