On Sat, 30 Oct 2004 15:17:16 -0700, Shane Wegner
<[EMAIL PROTECTED]> wrote:
> Hello,
(...)
> I want to retrieve any last names with more than 1
> occurence in the table.  Under MySQL, this query does the
> trick.
> select lastname,count(*) as c from names group by lastname
> having c > 1;
> 
> But under PG, it errors out
> ERROR:  column "c" does not exist
> 
> Is it possible to do a query like this with PostgreSQL?

select lastname,count(*) as c from names group by lastname having count(*) > 1;

HTH

Ian Barwick
[EMAIL PROTECTED]

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to