Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with TOP and UNION
Message
 
 
To
27/12/2004 11:47:40
John Deupree
Long Term Care Authority
Tulsa, Oklahoma, United States
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00972363
Message ID:
00972372
Views:
17
John,

Try (not tested)
SELECT plan, begindate 
	FROM mytable 
	WHERE begindate IN ( 
		SELECT TOP 3 begindate 
		FROM mytable 
		ORDER BY begindate DESC) 
UNION ALL
	SELECT MAX(plan) + 1, CAST(Null AS D)
	FROM mytable 
ORDER BY begindate DESC
>Yep, I was hoping to bypass the stored procedure route, but it looks as though it's the only way.
>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform