filemakerdeveloper40 Posted January 19, 2019 Posted January 19, 2019 I feel like the answer is right in front of me, but I can't seem to nail it. I keep getting a syntax error. Here is my calc (testing in the data view for now): Let ([ theDate = Totals_Daily::Daily_Totals_From_Date ; ID = Totals_Daily::ID ; query = "SELECT SUM (Daily_Qty) FROM Totals_Daily WHERE Daily_Totals_From_Date=? AND ID=? GROUP BY Daily_Totals_From_Date,ID" ]; ExecuteSQL ( query ; "" ; "" ; theDate ; ID ) ) If I remove the second parameter (ID) and simply sum by the date, I get a result. As soon as I add the "AND ID=?" I get a syntax error.
beverly Posted January 19, 2019 Posted January 19, 2019 ID is a reserved word. Try escape quoting the "name": WHERE Daily_Totals_From_Date = ? ( AND \"ID\" = ? )
comment Posted January 20, 2019 Posted January 20, 2019 (edited) 10 hours ago, beverly said: ID is a reserved word. ID is not listed as a reserved word in the documentation, and I encountered no problems using it as a field name without quoting it: 10 hours ago, filemakerdeveloper40 said: Here is my calc Could you provide a description of the fields referenced in the calculation? Or even better, upload a small demo file, so we can reproduce the problem. Edited January 20, 2019 by comment
Ocean West Posted January 30, 2019 Posted January 30, 2019 is it possible that the value is cast from a number to text or vice versa since the ID is set to a let variable? perhaps put the fields directly as arguments in the sql vs converting them to let scoped variables?
Recommended Posts
This topic is 2215 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