select payload->>'community' Gemeinde, item Projekt, 
  payload->>'projectState' Status, payload->>'active' Aktiv,
  to_char(tstamp, 'DD.MM.YYYY') Datum
from messages_current 
where domain='kiss' and class='project' 
  and (payload->>'projectState')::integer <> 20
  --and payload->>'active' is not null  
  order by payload->>'community', item 
-- \g projects_10_30_40.csv
