On Fri, 2008-10-17 at 15:30 -0400, Kynn Jones wrote: > Suppose I have two table X and Y and I want to compute the ratio of > the number of rows in X and the number of rows in Y. What would be > the SQL I could type into a psql session to get this number? Sub-selects should work. And make sure to cast to avoid integer division (well, assuming you want to avoid it...) SELECT (SELECT COUNT(*) FROM tablex)::numeric / (SELECT COUNT(*) FROM tabley)::numeric AS ratio; - Josh Williams -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general