Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Statement Help
Kobee,
I think the best approach here might be to use pl/sql create a function which returns the value of the type first and pass this to a package procedure which then gives the required output depending output from the function.
Sql will this type of query very difficult to manage. Kobee wrote:
> Hi,
>
> I've been trying to get this SQL, but I just can't get it to work. It
> should a be a relatively simple SELECT on a single table, with 2
> criteria - a date range for "lastupdate". Basically it's like "give me
> all the records from this table where the lastupdate is between
> startdate and enddate." There's one catch, though. There are three
> types of "transaction_types" in this table: "Add", "Update", "Delete".
> If the type is "Update", then there will be always be 2 records, with
> possibly different lastupdate values. The catch is that this SQL has to
> return the second "Update" row, even if it has a lastupdate outside of
> the specified date range. What's the best way to accomplish this?
>
> Thanks in advance for any help. My SQL is not up to par...
Received on Sat Jul 08 2006 - 03:43:08 CDT