Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3330 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (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 p
ON 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 p
ON p.\"_pk_payment_id\" = n.\"_fk_payment\"

WHERE p.\"date\" >= ? AND p.\"date\" <= ? AND n.commissionType = ?
"

;"";""; ~begin ; ~end ; "Sales"
)

)

Edited by Ron Cates
Posted

:beer: 

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. 

Posted

Yep, and fields that begin with an underscore was the other issue. Good job, Ron.

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.