-
limiting returns
I have patients with their lab result. Some have 1-5 labs. I want to write
a sql that will only return 1 or 2 og theirs most recent labs. help.....
-
Re: limiting returns
this will work in TSQL/MS SQL 7+:
SELECT TOP 1 *
FROM labs
WHERE patient_id = @ThePatientId
ORDER BY visit_date DESC
--
HTH,
David Satz
Principal Web Engineer
Hyperion Solutions
{ SQL Server 2000 SP1/7.0 SP3/6.5 SP5a } { Cold Fusion 5/4.5.1 SP2 } { VSS }
(Please reply to group only - emails answered rarely)
-----------------------------------------------------------------
"Tom H" <divebudsc@mindspring.com> wrote in message
news:3c6abfcb$1@10.1.10.29...
>
> I have patients with their lab result. Some have 1-5 labs. I want to write
> a sql that will only return 1 or 2 og theirs most recent labs. help.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks