>SELECT id, first, middle, last, type, expdt, fromdt, thrudt, 9999.99 as dues, 999 as instal, 9999 as months from master where group = 'Member' and delet <> 1 and exprdt >= m.expdt1 and expdt <= expdt2 and id not in (select dueid from dues where period = ?m.period or (duetype = 'LIFE' and thrudt = '12/31/9999')) order by last
If you run the query in iSQL/W does it still seem to take as much time. I'm wondering if the problem is how SQL Server is solving the query or whether it's VFP writing the result to disk when it creates the cursor.
Bob made some good suggestions. Definitely make sure that the index statistics are up to date. You'll probably get better results if you place a clustered index on master.exprdt. But you might affect something somewhere else.
SQL Server 6.5 doesn't really handle "not equals" very well. Could you change:
delet <> 1
To:
(delet < 0 or delet > 1)
SQL Server has special routines to handle ORs so it might work.
Since the only thing you're changing is the date range, I don't think that the problem is in the subquery.
Good luck
-Mike