Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ExecuteSQL() sums and group by ERROR...

Featured Replies

Hey gang,

Trying to figure something for a fellow lister. I am tring to run a query in FileMaker using ExecuteSQL() that works perfectly when I run a similar query in a normal SQL editor:

SELECT
p.pk_ProductID,
p.Description,
SUM(i.Quantity) AS sQTY  

FROM invoice_invoicelines_Product p  

JOIN invoice_InvoiceLines i ON p.pk_ProductID = i.fk_ProductID AND i.fk_InvoiceID IN (1,2,3)  

WHERE p.pk_ProductID IN (1,2,3)  

GROUP BY p.pk_ProductID

It produces a "?" (which is very informative).

I guess need to know if this is too much for FileMaker's SQL engine or if FileMaker is going to force me to use something that is not tradition SQL protocol/syntax.

 

Any feedback would be appreciated.

? return indicates a syntax error. you already know that.

you might want to check out...

http://www.soliantconsulting.com/blog/2013/11/filemaker-query-builder

http://mightydata.com/tips-for-debugging-filemaker-sql-queries/

http://www.fmfunctions.com/fid/335

 

My guess would be to look at FMSQL implementations where In () is used. I suspect that the single quoted list is the problem.

http://filemakerhacks.com/2012/10/19/the-missing-fm-12-executesql-reference/

Edited by Kris M

error is determined if you put EvaluationError() around the query. Look up the standard FM errors.

But I see TWO columns (fields) in the SELECT and both must be in the GROUP BY (not just an FQL thing...). GROUP BY needs all non-aggregate columns listed, comma-delimited:

GROUP BY p.pk_ProductID, p.Description

Beverly

  • Author

Ah, that worked, Bev!

Strange - in mySQL it does not require the "p.Description" in the GROUP BY clause.

Thanks!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.