Friday, 16 August 2013

sql query gives more then one, repeated data

sql query gives more then one, repeated data

What's wrong with this query; it gives me more then one repeated data
select (SELECT TOP(1) CariBakiye
FROM CariHesapHareketleri
WHERE CId = cr.CId
ORDER BY Trh DESC) as kk,
CariHesapHareketleri.CId
from Cari cr
join CariHesapHareketleri
on cr.CId = CariHesapHareketleri.CId
where kk > 0

No comments:

Post a Comment