0

エラー画像はこちら

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

構文エラーがありますか? 何が問題なのかわからないのですが、助けてもらえますか?

4

2 に答える 2

1

副選択が複数の行を返すが、たとえば最初の行が必要な場合は、制限 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
于 2016-10-07T15:05:15.797 に答える