Subject Calling all SQL Gurus...
Author Kevin Stanton
I have a history table with two fields: yr & mo (year and month) defined as
small ints.

Possibly have a design problem here.

When running a report, a user wants to select the date range from 8/1/01
thru 7/31/2002.

I've been trying various Selects but can't quite get it.

The below does not select anything:

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))
GROUP BY
H.CUSTNO, H.CUSTNAME
HAVING
SUM ( H.SALESAMT ) <> 0
ORDER BY
3 DESC

Is there a way to get this to work or do a need to create a field YYYYMM and
append the two fields together?

Thanks in advance for all ideas!

Kevin