How best to do column calculations?

Hello all,

In a table I have a FromDateTime and a ToDateTime, I need to calculate the difference and place that answer into a third column. In addition, I need to calculate the mean, median and mode and place those into another set of columns.

What is the best way to do this? One method of course is to do it within the Xojo app that needs the info. But, would it be better to off load work to PostgreSQL?

If using postgre, what is the best way to do this??

Thanks,
Tim

From postgresql - Postgres Time Difference - Stack Overflow

select extract (epoch from (t1.logout_date - t1.login_date))::integer/60

ie
UPDATE myDB SET myTimeMinutesField = extract (epoch from (t1.logout_date - t1.login_date))::integer/60

using the formule David gave at the previous post

1 Like

Thank you both for your replies!

Tim