mysql联合查询问题,各位帮我看看呗

SELECT c.BarCode,c.cnName,c.certNumber,r.ispass,r.enname,r.holdercountry,r.sex,r.birthday,r.dateissue,r.expirationdate,r.placebirth,
r.placeissue,e.Sender,e.ExpNumber,e.createTime,
(SELECT CONCAT(d.createTime,'|',d.direction,'|',ifnull(d.reason,'-1')) FROM bjpj_passport_record d WHERE d.createTime
=(SELECT MAX(createTime) FROM bjpj_passport_record b WHERE d.barcode=b.barcode)) AS storage FROM bjpj_passport_checkcert c
JOIN bjpj_passport_express e ON c.ProjectID=e.ProjectID JOIN bjpj_passport_cert r ON c.BarCode=r.barcode
报错[Err] 1242 - Subquery returns more than 1 row,各位有懂的没?

1个回答

SELECT CONCAT(d.createTime,'|',d.direction,'|',ifnull(d.reason,'-1')) FROM bjpj_passport_record d WHERE d.createTime
=(SELECT MAX(createTime) FROM bjpj_passport_record b WHERE d.barcode=b.barcode)

这句查询出来的条数大于1,所以结果集不能合并

jianming1234567890
Jason北京 嗯,本来就应该显示的是大于1的数据,该如何改呢?
4 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐