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 |
sigmas
Posting Yak Master
172 Posts |
Posted - 2013-07-17 : 15:13:48
|
Is there an efficient index for this query?use northwindSelect orderid, customerid, employeeid, orderdate, RequiredDateFrom(Select dense_rank() over(partition by employeeID order by orderdate desc) as rnk,*From orders)dWhere rnk = 1; |
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2013-07-17 : 15:49:04
|
possibly employeeID, orderdate desc but depends on how much data you have and what else is going on. |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2013-07-17 : 18:14:24
|
What are you hoping for? You can't answer that query without a scan on either an index or a table. |
|
|
|
|
|