更新时间:2023-12-01 09:31:04
SELECT (C1+C2*3-C3*5/C4) AS formula FROM table;
您可以在公式后使用AS [alias]
为其命名.以后是否可以使用取决于您要在哪里使用.如果要在where子句中使用它,则必须将其包装在外部select中,因为where子句是在别名之前求值的.
You can give it an alias using AS [alias]
after the formula. If you can use it later depends on where you want to use it. If you want to use it in the where clause, you have to wrap it in an outer select, because the where clause is evaluated before your alias.
SELECT *
FROM (SELECT (C1+C2*3-C3*5/C4) AS formula FROM table) AS t1
WHERE formula > 100