On Sun, 29 Apr 2007, Alexander Staubo wrote:
This is a common enough problem. Three factors come to mind: (1) Can all your intervals be expressed in absolute time units, such as number of days? "Work shift" is a human concept whose length is defined by context.
Alexander, If the requirements were in days, weeks, and months I could probably find a time unit that worked -- including the PostgreSQL-specific solution. However, when a regulatory agencies requires sampling once per shift, there may be 1, 2, or 3 shifts per day. I don't want to hard code the current solution because the company may add or subtract shifts depending on business conditions. I have a second column for 'interval_unit', but while that works it strikes me as less-than-elegant SQL. However, it might be the pragmatic answer, despite making it very difficult to do temporal arithmetic to see if required sampling was done and entered in the application. Thanks, Rich -- Richard B. Shepard, Ph.D. | The Environmental Permitting Applied Ecosystem Services, Inc. | Accelerator(TM) <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863