peter pilsl wrote:
> But there is a problem now: There are also entries in fn_kat which dont
> have corresponding entries in fn_dokumente and this entries should be
> listed too. With the proper count=0 !!
Your problem is not on the GROUP BY, but rather that you need an outer
join. Try something like
select k.kategorie,count(d.oid) from fn_kat k left join fn_dokumente d
on k.id=d.kategorie group by k.kategorie;
--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"The first of April is the day we remember what we are
the other 364 days of the year" (Mark Twain)