Well, here is an untested SP version:


Create procedure MyPOSProcedure
            @WhatDate datetime


as


set nocount on


select ID, max(DateDisplayEnd) as MaxDate
            into #TempTable
            from Tbl_Menu_Content
            where DateDisplayEnd > @WhatDate and ContentQueueID = 2


select tmc.ID, max(tmc.ContentID) as ContentID, tmc.DateDisplayEnd
            from #TempTable tt
                        inner join Tbl_Menu_Content tmc on tt.ID =
tmc.ID and tt.MaxDate = tmc.DateDisplayEnd
            where tt.ContentQueueID = 2
            group by tmc.ID, tmc.DateDisplayEnd
            order by tmc.ID, tmc.DateDisplayEnd


End


You'd then call it with:  MyPOSProcedure getdate() or MyPOSProcedure
'8/20/2004' or whatever date you need there.

-----Original Message-----
From: Bosky, Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, August 20, 2004 15:41
To: SQL
Subject: RE: return only one row for each id field that meets the
criteria .


Any chance of digging up an example of either method mentioned?

I was planning on making a stored procedure with the query once it was
functioning as intended.

Thanks Again!
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to