Would the following work?

Select order_date,
(select min(date) from calendar_table
where date >= order_date + 6 days and business_day = 'Y')) as Ship_Date
from ORDERS

-Tom Stieger
IT Manager
California Fine Wire


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jon Paris
Sent: Tuesday, July 12, 2011 9:31 AM
To: midrange-l@xxxxxxxxxxxx
Subject: SQL Inspiration needed

I'm collecting alternative solutions for a couple of SQL "problems" - things that would be relatively easy (if laborious) in native RPG.

So ... given that I have a table ORDERS which contains order and shipping dates, I need to populate the shipping dates such that the shipping date is 6 "business days" after the order date.

Business days can be determined from a calendar table keyed on date and which contains a "Y" or "N" to indicate whether that date is a business day or not.

Any ideas? The only ones we come up with are so darn nasty.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com




--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.