Subject | Re: [ib-support] Calling all SQL Gurus... |
---|---|

Author | Svein Erling Tysvaer |

Post date | 2002-08-23T08:46:02Z |

Brilliant! That should cover all cases, and can be even further improved:

and (H.Yr between 2001 and 2002 and (H.mo >=8 or H.Yr > 2001) and (H.mo<=7

or H.Yr < 2002))

Kevin, you just got yourself a neat solution (you may just have to tweak a

bit to make the optimizer select the right index),

Set

At 09:53 23.08.2002 +0200, you wrote:

and (H.Yr between 2001 and 2002 and (H.mo >=8 or H.Yr > 2001) and (H.mo<=7

or H.Yr < 2002))

Kevin, you just got yourself a neat solution (you may just have to tweak a

bit to make the optimizer select the right index),

Set

At 09:53 23.08.2002 +0200, you wrote:

>why not just

> and ((H.Yr >= 2001 and (H.mo >=8 or H.Yr > 2001)) and (H.Yr <= 2002 and

> (H.mo

><=7 or H.Yr < 2002)))

>

>

> > > > SELECT

> > > > H.CUSTNO, H.CUSTNAME,

> > > > SUM ( H.SALESAMT ) AS SALESAMT, SUM ( H.GROSSMARGIN ) AS

> > > GROSSMARGIN

> > > > FROM CUST_HIST H

> > > > WHERE

> > > > H.COMPANY = '01' AND DIVISION = '01'

> > > > and ((H.Yr >= 2001 and H.mo >=8) and (H.Yr <= 2002 and H.mo <=7))

> > >

>

>

>

>

>To unsubscribe from this group, send an email to:

>ib-support-unsubscribe@egroups.com

>

>

>

>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/