2
Answers

SQL Group By Error

Soner Gonul

Soner Gonul

13y
1.5k
1
Hello

I have a SQL like this;

SELECT
..........
.........
(CASE WHEN GECIKME_CV(:TAR,B.HESAP_NO, 90, 9999, B.DOVIZ_KOD) > 0 THEN 100 ELSE 0 END) AS PROV,
.......
.......
FROM S_TEKLIF B
WHERE .........
..........
GROUP BY ........., ........, (CASE WHEN GECIKME_CV(:TAR,B.HESAP_NO, 90, 9999, B.DOVIZ_KOD) > 0 THEN 100 ELSE 0 END),......

I want to change this SQL like this;

SELECT
..........
.........
(CASE WHEN GECIKME_CV(:TAR,B.HESAP_NO, 90, 9999, B.DOVIZ_KOD) > 0 THEN 100 WHEN B.HESAP_NO IN (SELECT HESAP_NO FROM S_TAKIP_MUSTERI) THEN 100 ELSE 0 END) AS PROV,
.........
FROM S_TEKLIF B
WHERE .........
..........
GROUP BY ........., ........, (CASE WHEN GECIKME_CV(:TAR,B.HESAP_NO, 90, 9999, B.DOVIZ_KOD) > 0 THEN 100 WHEN B.HESAP_NO IN (SELECT HESAP_NO FROM S_TAKIP_MUSTERI) THEN 100 ELSE 0 END),......

But this query doesn't work. Getting a GROUP BY error.

I attach my full code this post

Attachment: new text document.rar

Answers (2)