是否有可能在MySQL SQL中重用值?

时间:2016-09-29 15:18:37

标签: mysql sql

假设我有复杂的表达式,我希望重用它。

下面我必须写Complex Expression 2次:

SELECT "Complex Expression" AS V, "Complex Expression" LIKE "%lex%" W

我会写

SELECT "Complex Expression" AS V, V LIKE "%lex%" W

但MySQL发誓。

如何克服?

1 个答案:

答案 0 :(得分:0)

也许是这样的:

select * from (
   select "Complex Expression" AS V
   from table) AS subquery
where V like '%lex%'