Slick Query

From: <artmerar_at_yahoo.com>
Date: Fri, 25 Jul 2008 10:06:12 -0700 (PDT)
Message-ID: <f2ae60df-1cb2-4701-a278-e1cd85ad1018@v13g2000pro.googlegroups.com>


I want to see if I can create a slick query to do this and cut down on some code.

I have a list of dates & statuses like this:

01/05/08 Complete
02/15/09 Complete
02/18/08 Active
05/10/08 Cancelled
06/07/08 Pending
02/19/08 Complete

I'll order them in the query. What I need to do is first check to see if there is a status of Active or Pending and return the first one I encounter. If those do not exist, I need to return the first Complete or Cancelled I encounter.

In this case Active would be returned.

Right now I have a cursor and some PL/SQL going through 2 loops checking for Active/Pending, then Complete/Cancelled. I'd like to see if I can do it all in one query.

Any hopes of doing this? Received on Fri Jul 25 2008 - 12:06:12 CDT

Original text of this message