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.

Percentage with execute SQL

Featured Replies

Hi everybody,

 

i'm going to calculate a percentage with ExecuteSQL, but i believe my syntax is wrong.

 

i've 2 multiple field which show type and sale (total for type) as list, as in the picture.

 

Now i'd like to calculate a percentage on the total for each type.

 

Table are 2,

Customer where i've all customer information as name, address etc, and Type

and Invoice... 

 

for the multiple field called "Ricavi" (SALES in English) i used this:

 
ExecuteSQL("
SELECT SUM(A2.TOTAL) TOTAL
FROM CUSTOMERS A1
LEFT OUTER JOIN INVOICE A2 
ON A1.ID_CUSTOMER=A2.ID_CUSTOMER
GROUP BY A1.TYPE
";
"";""
)

 

If i write in the new calculated filed as follow it doesn't work:

 

ExecuteSQL("
SELECT SUM(A2.TOTAL) TOTAL *100 / (SELECT SUM (A2.TOTAL) From INVOICE A2)
FROM CUSTOMERS A1
LEFT OUTER JOIN INVOICE A2 
ON A1.ID_CUSTOMER=A2.ID_CUSTOMER
GROUP BY A1.TYPE
";
"";""
)

 

Who can HELP ME?

 

Thanks a lot

 

@

 

 

post-108850-0-36548500-1383393475_thumb.

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.