SELECT
	x1.concept_id AS concept_id,
	x3.value AS language_from,
	x2.value AS value_from,
	y3.value AS language_to,
	y2.value AS value_to
FROM
	concept_expressions AS x1 INNER JOIN concept_expressions AS y1 ON ((x1.id <> y1.id) AND (x1.concept_id = y1.concept_id))
	LEFT OUTER JOIN expressions AS x2 ON (x1.expression_id = x2.id)
	LEFT OUTER JOIN languages AS x3 ON (x2.language_id = x3.id)
	LEFT OUTER JOIN expressions AS y2 ON (y1.expression_id = y2.id)
	LEFT OUTER JOIN languages AS y3 ON (y2.language_id = y3.id)
WHERE
	(
		(
			(:language_from = '_')
			OR
			(x3.value = :language_from)
		)
		AND
		(
			(:language_to = '_')
			OR
			(y3.value = :language_to)
		)
		AND
		(x2.value LIKE :part)
	)
;

