0

谁能告诉我为什么我的查询返回空。我对 postgreSQL 很陌生,我不确定我是否正确访问了这两个数组。我还尝试了一个带有状态的子查询。

这是查询:

SELECT * FROM piecedef pd, pieceinst pi 
WHERE pi.truckno IN ('29,26,25,2,16,15,14,13,12,11,10')
AND pi.status IN (3601,102,201)        
AND pi.defid=pd.pdid
AND pd.projectid='4592'
ORDER BY pi.piid

Truckno 是 varchar (15),状态是 int4 (32)。提前致谢!

4

1 回答 1

2

尝试

SELECT * FROM piecedef pd, pieceinst pi
WHERE pi.truckno IN ('29','26','25','2','16','15','14','13','12','11','10') 
AND pi.status IN (3601,102,201)        
AND pi.defid=pd.pdid
AND pd.projectid='4592'
ORDER BY pi.piid

您的错误似乎是:varchar 数组需要引号之间的每个元素,否则它将被视为长 varchar 的元素...

于 2012-10-16T15:27:11.083 回答