February 11, 2005 at 3:58 am
February 11, 2005 at 4:09 am
There is no such thing as a last record. You might want to consider this:
USE NORTHWIND
GO
SELECT
(SELECT
OrderDate
FROM
Orders
WHERE
OrderID =
(SELECT MIN(OrderID)
FROM Orders)) AS First_Order
,
(SELECT
OrderDate
FROM
Orders
WHERE
OrderID =
(SELECT MAX(OrderID)
FROM Orders)) AS Last_Order
First_Order Last_Order
------------------------------------------------------ ------------------------------------------------------
1996-07-04 00:00:00.000 1998-05-06 00:00:00.000
(1 row(s) affected)
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply