gpt4 book ai didi

MySQL:错误代码:1242 子查询返回超过 1 行

转载 作者:行者123 更新时间:2023-11-29 11:14:52 26 4
gpt4 key购买 nike

error image here

SELECT daire.code, daire.durumu, daire.blblkodu, CONCAT(cari.adi , cari.soyadi) AS sahibi,
CASE daire.blkrcrkodu WHEN '0'
THEN CONCAT(cari.adi,cari.soyadi)
ELSE (SELECT CONCAT(adi,soyadi)
FROM cari
WHERE blkodu = daire.blkrcrkodu
AND firma_code = 40
AND site_code = 84) END AS oturan,
daire.kat, daire.kapi_no, daire.giris_no, daire.alan_m2, daire.__formatted_date
FROM daire
INNER JOIN cari ON
(daire.blshcrkodu = cari.blkodu AND cari.site_code = 84 AND daire.site_code = 84)
WHERE daire.site_code = 84
AND daire.firma_code = 40
ORDER BY daire.blkodu DESC

我有语法错误吗?我不明白问题出在哪里,你能帮我吗?

最佳答案

如果子选择返回多于一行,但您需要例如第一个,则可以使用 limit 1

SELECT daire.code, daire.durumu, daire.blblkodu, CONCAT(cari.adi , cari.soyadi) AS sahibi,
CASE daire.blkrcrkodu WHEN '0'
THEN CONCAT(cari.adi,cari.soyadi)
ELSE (SELECT CONCAT(adi,soyadi)
FROM cari
WHERE blkodu = daire.blkrcrkodu
AND firma_code = 40
AND site_code = 84
LIMIT 1) END AS oturan,
daire.kat, daire.kapi_no, daire.giris_no, daire.alan_m2, daire.__formatted_date
FROM daire
INNER JOIN cari ON
(daire.blshcrkodu = cari.blkodu AND cari.site_code = 84 AND daire.site_code = 84)
WHERE daire.site_code = 84
AND daire.firma_code = 40
ORDER BY daire.blkodu DESC

关于MySQL:错误代码:1242 子查询返回超过 1 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39920179/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com