Jump to content
Server Maintenance This Week. ×

ExecuteSQL syntax question


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

Recommended Posts

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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