× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Or like this:

update orders set ship_date = (select min(dt) from dates where flag='Y' and dt>(select min(dt) from dates where flag='Y' and dt>(select min(dt) from dates where flag='Y' and dt>(select min(dt) from dates where flag='Y' and dt>(select min(dt) from dates where flag='Y' and dt>(orderdt))))))

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Dennis
Sent: Tuesday, July 12, 2011 12:42 PM
To: Midrange Systems Technical Discussion
Subject: Re: SQL Inspiration needed

OK... Decided to post regardless of the answer to whether 6 days is a hard value.

If it is, the following works, without recursion.

Unfortunately I cannot currently performance test this.

update orders set ship_date =
select day6.dt from
calndr day1, calndr day2, calndr day3
, calndr day4, calndr day5, calndr day6
where day1.dt=(select min(dt) from dates where dt>order_date
and flag='Y')
and day2.dt=(select min(dt) from dates where dt>day1.dt
and flag='Y')
and day3.dt=(select min(dt) from dates where dt>day2.dt
and flag='Y')
and day4.dt=(select min(dt) from dates where dt>day3.dt
and flag='Y')
and day5.dt=(select min(dt) from dates where dt>day4.dt
and flag='Y')
and day6.dt=(select min(dt) from dates where dt>day5.dt
and flag='Y')



Never say, "never."
---
--
Dennis
--
"I get my exercise acting as a pallbearer to my friends who exercise."
-- Chauncey Depew


Sent from my Galaxy tablet phone. Please excuse my brevity.
For any grammatic/spelling errors, there is no excuse.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.