View Single Post

   
  #7 (permalink)  
Old 02-28-2008, 08:26 PM
David Portas
 
Posts: n/a
Default Re: Tricky grouping query

> A possible slight improvement to OJ's version in my opinion is to add
> Eventid to the ORDER BY clause. This makes the logic of the query
> consistent, otherwise if the maximum severity level is tied you can't
> guarantee which row you will get back.


Or, more sensibly, you might want to order by a date so that you get the
*latest*, most severe event for the patient. Whatever works best for you.

....
ORDER BY E2.severitylevel DESC, E2.eventdate DESC ??? )

--
David Portas
------------
Please reply only to the newsgroup
--


Reply With Quote