Calculating correlation coefficient using PostgreSQL?

Posted by Dave on Stack Overflow See other posts from Stack Overflow or by Dave
Published on 2010-06-10T15:27:23Z Indexed on 2010/06/10 15:32 UTC
Read the original article Hit count: 208

I have worked out how to calculate the correlation coefficient between two fields if both are in the same table:

SELECT corr(column1, column2) FROM table WHERE <my filters>;

...but I can't work out how to do it when the columns are from different tables (I need to apply the same filters to both tables).

Any hints, please?

© Stack Overflow or respective owner

Related posts about postgresql

Related posts about calculated-columns