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)
 Returning single row from mult. parameter/results

Author  Topic 

hueby
Posting Yak Master

127 Posts

Posted - 2005-05-20 : 14:28:10
Hi, I was wondering if it's possible to have a SP that uses a start/stop date parameter and returns multiple row back, BUT I only want to return one of those rows (doesn't matter which). I've been trying to use the MAX function with no luck... does anyone have any ideas if this is possible?

Using this code:
SELECT     dbo.Jobs.Purchord, dbo.Jobs.Descr, jobs.subjobno, hours.datewrk
FROM dbo.Hours INNER JOIN dbo.Jobs ON dbo.Hours.SubJobNo = dbo.Jobs.SubJobNo
where jobs.subjobNo = @subjobno and (hours.datewrk between @startdate and @enddate)
GO

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-05-20 : 14:48:23
Use TOP 1

With Regards
Sreenivas Reddy B
Go to Top of Page
   

- Advertisement -