[EMAIL PROTECTED] writes: > Now i will create two views: > P1V: > select order_id as id1, count(*) as count1 from order_item where state=1 group by >order_id; > P2V: > select order_id as id2, count(*) as count2 from order_item where state=2 group by >order_id; Grouped views don't work very well in Postgres versions before 7.1. Time to update ... 7.1.3 is the current release. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html