Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

The following ExecuteSQL statement returns the correct count:

 

ExecuteSQL ( "
SELECT count (*) 
FROM "Class Member Data" 
WHERE ClassID = ? " 
; "" ; ""; 53)
 
But when I add some additional qualifying conditions like
 
ExecuteSQL ( "
SELECT count (*) 
FROM "Class Member Data" 
WHERE ClassID = ? and Region = ?
; "" ; ""; 53; 1)
 
it incorrectly returns 0.
 
What is the correct syntax?

 

Posted

Region is an unstored calculation field, result number (but I had already tried quoting it without any difference).  The calculation is members::region, where members is a properly related table (and that's why the calc is unstored).  I also tried using members::region directly in the sql statement, without success.

Posted

I'm not seeing anything wrong with your syntax offhand, and the fact your query result is a zero and not a question mark tells me it's probably not syntax.

So, how many members that are in class 53 actually have a region 1 value? That is what you're looking to count in this select statement, right?

Posted

There are 3 records in which the Region value is 1. (I picked class 53 because it only has 26 records to make it easier to troubleshoot).

Posted

Solved.  The copy I was doing the testing on was old, and didn't have class 53 records. I was looking at the live db's values, but testing on the local copy.  D-OH!

Posted

I see you've solved it, but I wanted to add that when I'm SQL troubleshooting, one of the first things to check is reserved words. I had tables named Language and Translation that tripped me up, for example. "Region" wouldn't have surprised me as reserved.

This topic is 4044 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.