Ron Cates Posted October 19, 2015 Posted October 19, 2015 (edited) Quite simply can anyone point out what is wrong with this? Let ([ ~begin = Reports » Selector::gDateBegin ;~end = Reports » Selector::gDateEnd ;~type = Reports » Selector::gPaymentType ]; ExecuteSQL ( "SELECT SUM ( n.commission ) FROM Commission n INNER JOIN Payments pON p._pk_payment_id = n._fk_payment WHERE p.date >= ? AND p.date <= ? AND n.commissionType = ?" ;"";""; ~begin ; ~end ; "Sales") ) Just trying to pull the total Sales commissions for a date range. Thanks Never mind. I got it. Just had to do some quoting... Let ([ ~begin = Reports » Selector::gDateBegin ;~end = Reports » Selector::gDateEnd ;~type = Reports » Selector::gPaymentType ]; ExecuteSQL ( "SELECT SUM ( n.commission ) FROM Commission n INNER JOIN Payments pON p.\"_pk_payment_id\" = n.\"_fk_payment\" WHERE p.\"date\" >= ? AND p.\"date\" <= ? AND n.commissionType = ?" ;"";""; ~begin ; ~end ; "Sales") ) Edited October 19, 2015 by Ron Cates
beverly Posted October 22, 2015 Posted October 22, 2015 Cheers! you found a common mistake: use of keyword/reserved word in the name of a table or field (column). Consider renaming your 'date' field to something like 'paymentDate'. You'll be glad later.
Fitch Posted October 22, 2015 Posted October 22, 2015 Yep, and fields that begin with an underscore was the other issue. Good job, Ron. 1
Recommended Posts
This topic is 3330 days old. Please don't post here. Open a new topic instead.
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