doughemi Posted June 7, 2014 Posted June 7, 2014 Trying to wrap my head around ExecuteSQL(). I haven't used it enough to be fluent in it yet. I have a calculation in the Classes table to count the number of boats in a region: ExecuteSQL( "SELECT count ("OwnerID") FROM "Class Member Data" WHERE "Region" = ? and "ClassID" = ? and "ownerCurrent" = ?"; "";""; 1; ID; 1; 1 ) (ID is a field in the Classes table.) Which gives me a number, but not the same number as performing a Find for Region = 1 and ClassID = Classes::ID and ownerCurrent = 1 in a Class Member Data layout. So I want to create a list of OwnerIDs to see where the discrepancy lies to allow me to figure out the reason for it. I created another calculation field ExecuteSQL( "SELECT"OwnerID" FROM "Class Member Data" WHERE "Region" = ? and "ClassID" = ? and "ownerCurrent" = ?"; "";""; 1; ID; 1; 1 ) which only returns one OwnerID, where I was expecting a list of all OwnerIDs that fit the WHERE criteria. What have I overlooked or misunderstood?
john renfrew Posted June 7, 2014 Posted June 7, 2014 Are the region, ClassID and ownerCurrent fields numbers or text? Why 4 optional variables when you are using 3? What happens if you hard code the query into the select first?
Recommended Posts
This topic is 4074 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