SQL: Query for showing group posts is improved, order by comment date now is working again

The query for showing group posts is changed to a join that is more effective.

Bugfix: Order by comment date had been broken (by me?) some time ago. This is now fixed.

Addtionally I did some code cleanup.