当我尝试这个我得到一个语法错误,但不知道如果它的我的方法可能是错误的。我试图在表中添加一个标志来识别某些记录使用公式作为视图创建的一部分
Create view
as
SELECT
col1 * 0.5/col2 as value_per_sqm,
col3/col2 as other_value,
(col1 * 0.5/col2) < (col3/col2) as higher
其中返回; ERROR: syntax error at or near "("
调整上述我可以看到,我可以运行一个布尔值,并返回true如果我不使用方程和前两个方程的工作。我试过了;
Create view
as
SELECT
col1 * 0.5/col2 as value_per_sqm,
col3/col2 as other_value,
(value_per_sqm) < other_value) as higher
但由于它不建立就不能查询列。
任何帮助,衷心感谢
只要把前两个(value_per_sqm和other_value)的一个子查询,然后选择所有三个子查询。顺便说一句,你需要一些逗号! –
谢谢,只是要弄清楚如何做子查询,逗号在那里,现在在问题 –