select a.gross, a.nett, a.cost,
b.to_char(float8 (SUM(pymt+budget)*1000000)/(SUM(area)*40000),'FM999999999.00') AS xyz
FROM a, b
WHERE a.id=b.id
AND id='123456';
为什么我一直收到此错误消息:
ERROR: schema "b" does not exist
********** Error **********
ERROR: schema "b" does not exist
SQL state: 3F000
答案 0 :(得分:1)
由于您的表to_char
中不存在b
,因此它会尝试在模式b
中找到它:
b.to_char
只需删除b
并使用它来限定列名:
to_char(
float8
(SUM(b.pymt + a.budget) * 1000000) /
(SUM(b.area) * 40000)
,'FM999999999.00'
) AS xyz