Results 1 to 4 of 4

Thread: Help please

  1. #1
    Join Date
    Jul 2003
    Posts
    9

    Exclamation Unanswered: Help please

    hElp me to make this statement faster please :



    select kontoja, isnull((select sum(t1.debi/v1.kursi) from transaksionet t1, valutat v1 where t1.idur <> 0 and t1.valuta = v1.id and t1.kontoja = t.kontoja),0) as debi,
    isnull((select sum(t1.kredi/v1.kursi) from transaksionet t1, valutat v1 where t1.idur <> 0 and t1.valuta = v1.id and t1.kontoja = t.kontoja ),0) as kredi,
    isnull((SELECT sum(t1.debi/v1.kursi) - sum(t1.kredi/v1.kursi) from transaksionet t1, valutat v1 where IDUR = 0 and t1.kontoja = t.kontoja and t1.valuta = v1.id),0) as saldofill from transaksionet t, [plan] p where t.kontoja = p.account2 group by t.kontoja

  2. #2
    Join Date
    Nov 2002
    Location
    Switzerland
    Posts
    524
    Cut this huge select. Will be more readable for you and more performant.

    Code:
    declare @cr money, @deb money
    
    select @cr=sum() 
    from ...
    
    select @deb=sum() 
    from ...
    
    select ..., @deb, @cr, @cr-@deb...

  3. #3
    Join Date
    Jul 2003
    Posts
    9

    Exclamation Thanks

    But if you have more time please please write for me the complete statement please because I am new in sql thanks a lot.

  4. #4
    Join Date
    Jul 2003
    Posts
    9

    Unhappy HELP HELP

    I WILL LOSE MY JOB IF I DONT FIX THIS HELP GUYS!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •