A simpler way to get the information you're looking at would be this:
WITH CTE AS
(
SELECT EventDate,EventTime,Temp, rn=ROW_NUMBER() OVER (PARTITION BY EventDate ORDER BY Temp ASC, EventTime ASC)
FROM mytable --Change to your table name, of course
)
SELECT EventDate, EventTime, Temp
FROM CTE
WHERE rn=1;
Turning that into a view is as simple as adding the following line at the beginning:
CREATE VIEW myview AS --Again, change to the desired name for the view as necessary
Cheers!
Yeah, I figured that out after taking a break for a while... (That's my crummy code he was posting about.)
Took me a minute to figure out I could use ROW_NUMBER() OVER () PARTITION... to do it. Turns out leaving myself hints worked pretty well.
Thank you for your help.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply