> should do the trick without double select, or? Indeed it seems to do so. The cost estimation is even about 10 times less with the real application's queries. I never really used group/having even though being aware of their existence. I probably should do so more often. ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster