Instead of the "?" in FM's ExecuteSQL, or having to resort to extra work in FM to get some kind of error message, wouldn't the error below be more helpful? This error comes directly from FM via the JDBC driver. (This particular error in particular can be confusing since not all database vendors SQL implementations have the GROUP BY requirement this error mentions.)
(Depending on the viewer you use....) Also, using a remote JDBC console (usually a Java IDE), in this case, you get get real-time field completion as you type the SQL statement and you see all the tables and fields in the interface too. Additionally, when you execute the SQL, you see TONS or rows (not just the few shown in FM's data viewer in a tiny, non-resizable font). You can also export that shown data to the clipboard, to a SQL query, CSV, etc.
I find this method, for any but the simplest queries, to be much faster and so much less frustrating than trying to figure out what FM is complaining about with the "?". Yes, the error is always my fault, but I need a quick way to get queries working. Once I get the query working, THEN I transfer it into the ExcecuteSQL statement and I'm basically done.
FileMaker makes this remote powerful query capability available and their JDBC driver is, from my experience, quite good. Why not use it?
Finally, if you're doing lots of complicated queries, having a real data console is fantastic.
Not to mention that FM's JDBC driver also supports INSERT, UPDATE, and DELETE.
Things to consider.