stan111 Posted June 1, 2021 Posted June 1, 2021 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
comment Posted June 1, 2021 Posted June 1, 2021 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?
stan111 Posted June 1, 2021 Author Posted June 1, 2021 Hi, Thanks for the reply. Please, take a look at the picture attached. Recorder Clipping (20∶48∶22).tiff
printdrive Posted June 24, 2021 Posted June 24, 2021 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now