So, I have three tables, table “local”, table item and table “item_local”. Here is data contains in the tables:
Table "local"
ID Local
1 Ru
2 En
Table "item"
ID Name
1 Test1
2 Test2
3 Test3
Table "item_local"
ID ItemID LocalID Text
1 1 1 Test-Ru
2 1 2 Test-En
3 2 1 Test-Ru
4 2 2 Test-En
5 3 1 Test-Ru
My problem is I don’t know the SELECT query with local that will display the result such as below:
Result if i select with local "Ru":
ID ItemID LocalID Text
1 1 1 Test-Ru
3 2 1 Test-Ru
5 3 1 Test-Ru
Result if i select with local "En":
ID ItemID LocalID Text
2 1 2 Test-En
4 2 2 Test-En
5 3 1 Test-Ru
Is there a query or any other way to get such the result?
Anyway, thanks for helping.
Note that the table
itemis not necessary. However, I guess you would like to see the missing entries in the step. This can be done by using theLEFT JOINand add the conditionWHERE il.ID IS NULL.Edit: Oh, is missed the fallback to “Ru”.