Optimizing SQL Query
Posted on 2016-08-31
I have the following SQL query which I need to optimize. Currently the execution time for this query is around 2 mins.
select top 1 o.ordernumber
from orders o with (Nolock)
inner join customer cu on cu.customerid=o.customerid
inner join orders_shoppingcart os1 on o.ordernumber=os1.ordernumber
inner join product p1 on p1.productid=os1.productid
and (p1.producttypeid = 1 or p1.producttypeid=7)
and (p1.name != 'General Fund'or p1.name != 'Corpus Fund')
--and o.transaction_source not like '%dedo'
order by o.createdon desc
Any help in this regard would be greatly appreciated,