Hi, and thanks for taking the trouble to reply! > WITH num AS > ( > SELECT count (*) as cnt1 FROM v1 > ), > div AS > ( > SELECT count (*) as cnt2 FROM v2 > ) > SELECT (num.cnt1::numeric/div.cnt2); I get this error ERROR: missing FROM-clause entry for table "num" LINE 9: SELECT (num.cnt1::numeric/div.cnt2); Check out the fiddle here - https://dbfiddle.uk/?rdbms=postgres_10&fiddle=9fbe33f971b12ce637d03c1e7e452831 > Casting as numeric just in case you might have integer division... Yeah, forgot about the CASTing bit for the other method! Thanks again! Pól... > Todd