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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query Challenge of the Day

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-22 : 21:55:38
CREATE TABLE MyTable (
MyTableID INT IDENTITY ,
QueueDate datetime,
other fields....
)

MyTable has 'runs' of data at the same datetime.

SELECT DISTINCT QueueDate FROM MyTable -- Returns all unique dates

Now - what is the simplest query that will return ANY MyTableID for each DISTINCT value of QueueDate? (I need a single recordset of MyTableID for each distinct QueueDate).

Sam

nr
SQLTeam MVY

12543 Posts

Posted - 2003-03-22 : 22:15:49
select min(MyTableID), QueueDate
from MyTable
group by QueueDate


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-22 : 22:48:54

The difficult is made so easy.....

Sam

Go to Top of Page
   

- Advertisement -