我想從2表,其中第二個ID是從第一ID前4個字符等於選擇的PostgreSQL與子比較不起作用
SELECT a.*, b.*, substring(a.my_id from 1 for 4)::integer as number
FROM table1 as a
INNER Join table2 as b ON(b.id_2=number) where my_id = 101
^
It produces an error here |
錯誤:列「數量」不存在
SQL狀態:42703
性格:189
SELECT'列表中的別名在'FROM'列表中不起作用。將'子字符串(a.my_id從1開始4):: integer'移動到'ON'狀態。 – LisMorski 2012-07-25 10:37:41