hocam bu iki sorgu arasındaki fark nedir neden 2. sorgu çalışmıyor
Select
CLCARD.CODE AS KODU,
CLCARD.CITY AS ŞEHİR,
CLCARD.DEFINITION_ AS ÜNVANI,
CLCARD.SPECODE AS PLASİYER,
CASE WHEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT)>=0 THEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT) ELSE 0 END AS BAKIYE_BORC, CASE WHEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT)<0 THEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT) ELSE 0 END AS BAKIYE_ALACAK
FROM LG_008_05_CLFLINE CLFLINE INNER JOIN LG_008_CLCARD CLCARD ON CLFLINE.CLIENTREF = CLCARD.LOGICALREF AND CLFLINE.CANCELLED=0 AND CLCARD.ACTIVE=0 GROUP BY CLCARD.CODE, CLCARD.CITY, CLCARD.SPECODE, CLCARD.DEFINITION_ HAVING (((CLCARD.CODE) Like 'a%')) ORDER BY CLCARD.DEFINITION_
SELECT
lg_008_clcard.CODE AS ‘KODU’,
lg_008_clcard.DEFINITION_ AS ‘UNVAN’,
lg_008_clcard.SPECODE AS ‘PLS’,
lg_008_clcard.CITY AS ‘ŞEHİR’,
CASE WHEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT)>=0 THEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT) ELSE 0 END AS BAKIYE_BORC, CASE WHEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT)<0 THEN Sum(Case when SIGN=0 then 1 ELSE -1 END*CLFLINE.AMOUNT) ELSE 0 END AS BAKIYE_ALACAK
FROM LKSDB.dbo.LG_008_05_CLFLINE INNER JOIN LKSDB.dbo.lg_008_clcard
ON LG_008_05_CLFLINE.CLIENTREF = lg_008_clcard.LOGICALREF WHERE (CLCARD.ACTIVE=0) ORDER BY DEFINITION_