简体   繁体   English

PostgreSQL查询返回空

[英]PostgreSQL query returning empty

Can any one tell me why my query is returning empty. 可以任何人告诉我为什么我的查询返回空。 I am pretty new to postgreSQL and I'm not sure if I'm accessing the two arrays correctly. 我对postgreSQL很新,我不确定我是否正确访问这两个数组。 I also tried a subquery with status. 我还尝试了一个具有状态的子查询。

Here is the query: 这是查询:

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 is a varchar (15) and status is int4 (32). truckno是一个varchar(15),状态是int4(32)。 Thanks in advance! 提前致谢!

Try 尝试

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

What your error seems to be: an array of varchar needs each element between quotes, otherwise it will be considered as on eelement of a long varchar... 您的错误似乎是:varchar数组需要引号之间的每个元素,否则它将被视为长varchar的元素...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM