Jump to content

BETWEEN question


Charlatat
 Share

Recommended Posts

targetdate and now are defined elsewhere in my script (dBase backend). Original statement (works fine):SELECT contact1.contact,contact1.address1,contact1.address2,contact1.city,contact1.state,contact1.zip,conthist.ondate,contact1.key3,conthist.resultcode,conthist.accountno FROM conthist INNER JOIN contact1 ON conthist.accountno = contact1.accountno WHERE (conthist.RESULTCODE = 'TNS' AND (conthist.resultcode NOT IN ('SLE','SLD','SL1','SL2'))) AND (conthist.ondate = #%targetdate%#) AND (contact1.address1 <> '' OR contact1.city <> '' OR contact1.state <> '' OR contact1.zip <> '')Want to modify the (conthist.RESULTCODE = 'TNS' AND (conthist.resultcode NOT IN ('SLE','SLD','SL1','SL2'))) section so that only a certain date range is looked at. Was thinking the new statement should be something like this (doesn't work):SELECT contact1.contact,contact1.address1,contact1.address2,contact1.city,contact1.state,contact1.zip,conthist.ondate,contact1.key3,conthist.resultcode,conthist.accountno FROM conthist INNER JOIN contact1 ON conthist.accountno = contact1.accountno WHERE (conthist.RESULTCODE = 'TNS' AND (conthist.resultcode NOT IN ('SLE','SLD','SL1','SL2') BETWEEN #%targetdate%# AND #%now%#)) AND (conthist.ondate = #%targetdate%#) AND (contact1.address1 <> '' OR contact1.city <> '' OR contact1.state <> '' OR contact1.zip <> '')Any suggestions? Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...