Re: [SQL] Ambiguous error message

2004-01-02 Thread Bertrand Petit
On Fri, Jan 02, 2004 at 05:49:46PM +0100, Samuel Tardieu wrote: > > select texten, total > from (select protocolid, count(*) as total) from ips where catid=1 ^ +--- There > group by protocolid order by pr

Re: [SQL] Ambiguous error message

2004-01-02 Thread Michael Fuhr
On Fri, Jan 02, 2004 at 05:49:46PM +0100, Samuel Tardieu wrote: > In PostgreSQL 7.4, the following select: > > select texten, total > from (select protocolid, count(*) as total) from ips where catid=1 > group by protocolid order by protocolid) as c > inner join protocols using (protocolid)

Re: [SQL] Ambiguous error message

2004-01-02 Thread Samuel Tardieu
On 3/01, Samuel Tardieu wrote: | On 2/01, Michael Glaesemann wrote: | | | I'm not quite sure what you want the query to return, but you've got a | | problem with your parentheses. | | I can't believe this :) I got hit by the "inner query needs to be aliased" | message and added it to the wron

Re: [SQL] Ambiguous error message

2004-01-02 Thread Samuel Tardieu
On 2/01, Michael Glaesemann wrote: | I'm not quite sure what you want the query to return, but you've got a | problem with your parentheses. I can't believe this :) I got hit by the "inner query needs to be aliased" message and added it to the wrong place and them munged the query a lot. The c

Re: [SQL] Ambiguous error message

2004-01-02 Thread Tom Lane
Samuel Tardieu <[EMAIL PROTECTED]> writes: > In PostgreSQL 7.4, the following select: > select texten, total > from (select protocolid, count(*) as total) from ips where catid=1 > group by protocolid order by protocolid) as c > inner join protocols using (protocolid); > gives the error mes

Re: [SQL] Ambiguous error message

2004-01-02 Thread Michael Glaesemann
Hi Sam, I'm not quite sure what you want the query to return, but you've got a problem with your parentheses. You've got two FROM clauses and an INNER JOIN, which together aren't arranged properly. I've rearranged your query a little, but I haven't changed anything. Perhaps this'll make it a l

[SQL] Ambiguous error message

2004-01-02 Thread Samuel Tardieu
In PostgreSQL 7.4, the following select: select texten, total from (select protocolid, count(*) as total) from ips where catid=1 group by protocolid order by protocolid) as c inner join protocols using (protocolid); gives the error message: ERROR: subquery in FROM must have an alias HIN