sql server - Getting value twice in SQL -


After

I have a SQL like this,

  select B. .HESAP_NO, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2 as 'serious' B.MUS_K_IS I, dbo.fngcod clearance (B.HESAP_NO, B.DOVIZ_KOD, B.TEKLIF_NO1 + '/' + B. TEKLIF_NO2, '11 / 03/2011 ', '11 / 03/2011'), (The case is when B.DOVIZ_KOD = 21 'euro' when B.DOVIZ_KOD = 2 'USD' when B.DOVIZ_KOD = 1 then 'TL 'End') as KUR 'D.AVUKAT (case when in D.HESAP (select T_HESAP_NO by tracking) again (select ICRA_T by tracking where T_HESAP_NO = D.HESAP) and "end" As' ICRA scan ° hame ° (ma When in D.HESAP (select T_HESAP_NO by tracking) then (HACIZ_T by Tracking where T_HESAP_NO = D.HESAP) and 'End' as' Hacaki ° Z scan ° hame YAZ .. MARDATA.S_TEKLIF B, where Associate D ° B.HESAP_NO = D.HESAP and IsNull (dbo.fngcod game (B.HESAP_NO, B.DOVIZ_KOD, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2, '11 / 03 / 2011 ', '11 / 03/2011'), 0) & gt; 0 Group B.HESAP_NO, B.TEKLIF_NO1 by + '/' + B.TEKLIF_NO2, B.DOVIZ_KOD, B.MUS_K_IS I, D.AVUKAT, D.HESAP   

Here is my table ,

  S_TEKLIF TEKLIF_NO1 (b) follow the counsel HESAP_NO (P) account (P) T_HESAP_NO (P) MUS_K_IS I ICRA_T TEKLIF_NO2 lawyer HACIZ_T here MUS_K_IS I DOVIZ_KOD   

is my function,

  change function [dbo]. [Fngcod] is (@HESAP INT, @DOV INT, @TEKLIF VARCHAR (10), @BAS up dbo.fngcod VARCHAR (10), @BIT VARCHAR (10)) declared as set back float float @result @ result = (sum (choose amount) Where TEMEL_HESAP YAZ..MARDATA.M_GHAREKET @HESAP and DOVIZ_KOD = = = @DOV and REF_KOD start 'GC' and BACAK_GRUP = 'PERT' and ISL_KOD = like 1 and details' % '+ @TEKLIF +'% 'and ISL_T & gt; = CONVERT (DATETIME +' + + BAS + ', 103) and ISL_T <= CONVERT (DATETIME +' + + BIT + ', 103)) End   

Your head SQL is working right, but getting two @result returns the value with the same data.

enter image details here

Where did I make an error can go? After

Good luck,

Golder

This is the same, is not the offer column is different. You group on that column, so you two will get the result of difference.

Comments