Charlatat Posted November 20, 2006 Share Posted November 20, 2006 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 More sharing options...
pulpfiction Posted November 20, 2006 Share Posted November 20, 2006 You seem to be missing field name for the date check....AND (conthist.resultcode NOT IN ('SLE','SLD','SL1','SL2') AND TblName.Fldname BETWEEN #%targetdate%# AND #%now%#)) AND..... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now