Glenn <glenn@pip.com.au> writes:
> Seems I've actually asked the wrong q...
> My query was something like
> "SELECT f1,f2,count(f3) as countOff3, sum(f4) as countoff4,f5,"-" as f6
> FROM mytable
> GROUP BY f1,f2,f5,"-""
You never need to group by a constant, so this would work fine (and be
compliant with the standard, which your given example is not):
SELECT f1,f2,count(f3) as countOff3, sum(f4) as countoff4,f5,"-" as f6
FROM mytable
GROUP BY f1,f2,f5
> Once I took out everything to do with f6, then it worked - however I
> need f6, as this forms a select to be inserted into another table.
Depending on what's happening upstream, it might also help to explicitly
cast the "-" to some specific datatype, eg
select ..., "-"::varchar as f6 ...
regards, tom lane