Hello, I am trying to get Company list, my problem is about taking included CopmanyType neme as language compatible. For this I created an query it works. Is there any way to include this query instead of included CopmanyType that showed at photo as procedure ?
Is my system right or could you recommend me any other better way?
This is my sample query that if there is no "de" on "Translates" table then taking default language that "en" from "CompanyTypes" table.
SELECT
ctt.IDX,
ctt.TypeName,
ctt.LanguageCode
FROM (
SELECT
ct.IDX as IDX,
ct.TypeName AS TypeName,
"en" AS LanguageCode,
1 as Priority
FROM CompanyTypes AS ct
UNION ALL
SELECT
ct.IDX as IDX,
t.Translated AS TypeName,
t.LanguageCode AS LanguageCode,
2 as Priority
FROM CompanyTypes AS ct
INNER JOIN Translations AS t ON LOWER(t.English)=LOWER(ct.TypeName)
ORDER BY IDX, Priority DESC
) AS ctt
where LanguageCode = "en" OR LanguageCode = "de"
GROUP BY ctt.IDX