Re: Select previous records
Date: Tue, 12 May 2009 15:01:22 -0700 (PDT)
On May 7, 5:36 pm, a..._at_unsu.com wrote:
> Hoping to do this in one query without writing code.
> Got an order table:
> Customer ID
> Order Date
> Customer places an order, status becomes 'Active' and 1 year later the
> customer can re-new or cancel. If customer renews then current order
> goes to 'Complete' and new order is placed with 'Active'.
> I need to know, for any given date, is current 'Active' order result
> of a 'renew'. So, is there an order 1 year ago.
> Not sure how this is done, maybe with some analytical stuff?
> Basically take order from now, look back 1 year and see if there is an
> order there.....
> Possible without PL/SQL I hope....
Well, you could just say trunc(order_date) - 365 or whatever, but of course, that might not be a business day, so you need some way of knowing what the possible business dates or windows are one year ago, and don't forget about leap years and is this just for one political unit or can you have different holidays and can customers be related or buy each other or multiply subscribe and what if this all dies in the middle and what if the check is in the mail already and...
So, what is a customer, what is a year, what is an order, what is analytical stuff, what is code? Interesting business day solutions out there with some googling.
I have been absolutely floored [geek joke intentional] with how really bad some of the magazine renewals have been, including one of my favorite magazines I've been charter subscribed since the early '80's never cashing my check at least 3 times in recent years.
-- _at_home.com is bogus. Occifer, I hav a rite to C the sour code! http://www.twincities.com/news/ci_12267906?source=rssReceived on Tue May 12 2009 - 17:01:22 CDT