<p>I have a table with columns</p>

<blockquote>
  <p>Index, Date</p>
</blockquote>

<p>where an Index may have multiple Dates, and my goal is the following: select a list that looks like</p>

<blockquote>
  <p>Index, MinDate, MaxDate</p>
</blockquote>

<p>where each Index is listed only once, and MinDate (MaxDate) represents the earliest (latest) date present <em>in the entire table for that index</em>.  That's easy enough, but then let's constrain this list to appear only for Indexes that are present in a given range of dates. </p>

<p>So far, I have the following:</p>

<pre><code>SELECT 
    Index,
    MIN([Date]),
    MAX([Date])
FROM myTable
WHERE
    Index IN
    (SELECT Index From myTable WHERE [Date] BETWEEN '1/1/2000' AND '12/31/2000')
GROUP BY Index
ORDER BY Index ASC
</code></pre>

<p>This is excruciatingly slow.  Any way to speed this up?  [I am running SQL Server 2000.]</p>

<p>Thanks!</p>

<p>Edited: For clarity.</p>

You don't need the sub-select in the where clause.  Also, you could add indexes to the date column.  How many rows in the table?
```
```
SELECT
    [INDEX],
    MIN ( [Date] ),
    MAX ( [Date] )
FROM
    myTable
WHERE 
    [Date] Between '1/1/2000' And '12/31/2000'
GROUP BY
    [Index]
ORDER BY
    [INDEX] ASC
```
```