From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Glenn <glenn(at)pip(dot)com(dot)au> |
Cc: | Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>, PostgreSQL Mailing List <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: Cant group by non integer - ms access - odbc |
Date: | 2002-12-18 16:07:14 |
Message-ID: | 23223.1040227634@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Glenn <glenn(at)pip(dot)com(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Patrick Hatcher | 2002-12-18 16:08:54 | Re: Cant group by non integer - ms access - odbc |
Previous Message | Jules Alberts | 2002-12-18 16:00:38 | Re: how to traverse a bytea value in pl/pgsql |