The Fish 10588 Posted May 16, 2017 Share Posted May 16, 2017 Lads, I'm trying to run the following query, but it's taking ages. Any idea how I can summarise it to speed it up any? Select Td.Branch, Td.Cust_Code, td.prod_dept, td.supplier_code,s.supplier_name, REPLACE(CONVERT(VARCHAR,CONVERT(MONEY,cast(sum(case when record_type in (7,16) and *****.dbo.ftnGetGoLocalTopScheme(td.branch,td.cust_code) like 'g%' then total_value *-1 when record_type not in (7,16) and *****.dbo.ftnGetGoLocalTopScheme(td.branch,td.cust_code) like 'g%' then total_value else 0.00 end)as decimal(10,2))),1),'.00','.00') as [GL Spend] From Transaction_Details as Td left outer join dbo.supplier as s on td.supplier_code=s.supplier_code Where Td.Branch >0 and Td.Date_Transaction Between '2015-06-24' AND '2016-04-29 23:59' Group By Td.Branch, Td.Cust_Code, td.prod_dept, td.supplier_code, s.supplier_name Cheers Link to comment Share on other sites More sharing options...
Howmanheyman 32301 Posted October 10, 2019 Share Posted October 10, 2019 I'm seeing a pattern emerging with the same poster starting the thread. 1 Link to comment Share on other sites More sharing options...
Alex 34417 Posted October 11, 2019 Share Posted October 11, 2019 Absolutely winging it 😂 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now