Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 1246 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Gents,

I am stuck with ExecuteSQL. 

The problem: 

I have 5 shipping containers with distinct numbers. But there are 6 records in the table.

I need to calculate the total weight for all 5 containers ( select distinct containers only). 

 

Thanks for your help!

SQL_containers.fmp12

Posted
21 minutes ago, stan111 said:

I need to calculate the total weight for all 5 containers ( select distinct containers only). 

I am not sure I understand this requirement. Do you mean you want to summarize the sum of both weights by containerNumber - so that the result in your example would be:

111,27800
222,17800
333,26000
444,37000
555,16000

or something else? 

  • 3 weeks later...
Posted

Hi Stan,

maybe you can try first to find only the PrimaryKeys of the records you want to sum, then you can sum the containerNetWeight for those records.

query_sum = "SELECT SUM(containerNetWeight) FROM SQL_containers WHERE PrimaryKey IN (SELECT max(PrimaryKey) FROM SQL_containers GROUP BY containerNumber)"

regards

 

This topic is 1246 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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