bugfix for postgresql

The SQL-Statement was'nt working with postgres.
I changed the SQL-Statement to be sql-ansi conform.