You cannot assign the same alias to several columns in the resulting table with the AS
construct. However, you can form one column that will accept the value found.
When forming the query, it should be remembered that the LIKE
construct is not necessarily applied only in the WHERE condition, you can use it after the SELECT
. By applying multiple CASE
choices, you can select the column that was detected and assign an alias to it using the AS
construct.
Thus, your request can be rewritten as
SELECT CASE WHEN name_EN LIKE '%param%' THEN name_EN WHEN name_RU LIKE '%param%' THEN name_RU WHEN name_TR LIKE '%param%' THEN name_TR END AS AL FROM tbl WHERE name_EN LIKE '%param%' OR name_TR LIKE '%param%' OR name_RU LIKE '%param%'
AL
? - Nofate ♦