junaid malik wrote:
Is there any alternative of mysql function COUNT(DISTINCT expr, [expr...]) in postgres. We get error if we write count like this count(distinct profile.id, profile.name, profile.age) but it works well in mysql. Reference url is given below http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_count-distinct Thanks
I already answered your question on dbforums.com. But in Postgres you can do:
SELECT COUNT( DISTINCT row(col1, col2, col3) ) FROM foo or SELECT COUNT( DISTINCT (col1, col2, col3) ) FROM foo -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general