Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mikejohnson
Posting Yak Master
153 Posts |
Posted - 2004-09-29 : 14:14:10
|
| any way you can see to optimize this statement?select vcTransactionStatus as [App Status], dtduedate as [Due Date], vcfirstname + ' ' + vclastname as Name, isnull((select sum(numAmount) from tblTransactionRegister where inttransactionid=t.inttransactionid group by inttransactionid),0) as Balance,'<a href=customer_applications.asp?intcustomerid=' + cast(c.intcustomerid as varchar(20)) + '>Go To</a>' as Action from tbltransactions t left join tblTransactionStatus s on t.intTransactionStatusID=s.intTransactionStatusID left join tblcustomers c on c.intcustomerid=t.intcustomerid where c.intlenderid=10000 and dtduedate<getdate() and isnull((select sum(numAmount) from tblTransactionRegister where inttransactionid=t.inttransactionid group by inttransactionid),0)>0 order by balance desc,[App Status] |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2004-09-30 : 09:25:45
|
| What's the execution plan look like??? |
 |
|
|
elwoos
Master Smack Fu Yak Hacker
2052 Posts |
Posted - 2004-09-30 : 18:21:29
|
| Make sure there are indices (if appropriate) on the fields in the order by clause. Perhaps use datediff in the where clauseSteve no function beer well without |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-09-30 : 18:24:01
|
| Mike, please format your query with code tags. Also, what you posted isn't a valid query so please fix that up for us.Tara |
 |
|
|
|
|
|