Thread

  1. SELECT COUNT(DISTINCT)

    Oleg Broytmann <phd@sun.med.ru> — 1999-02-22T13:22:31Z

    Hello!
    
       I am trying to execute query:
    SELECT city_id, COUNT(DISTINCT pos_id)
       ...
    GROUP BY city_id ;
    
       but got the error:
    ERROR:  parser: parse error at or near "distinct"
    
       It is me who do not understand SQL or postgres does not implement it?
    
    Oleg.
    ---- 
        Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net
               Programmers don't die, they just GOSUB without RETURN.
    
    
    
  2. Re: [HACKERS] SELECT COUNT(DISTINCT)

    Andy Selle <aselle@earth.mat.net> — 1999-02-22T13:46:09Z

    I was in need of that exact feature awhile back.  As far as I can tell it
    isn't supported.  I ended up using a complicated NOT EXISTS query instead.
    I've been meaning to hack this, but I haven't gotten a chance.  
    
    -Andy
    
    
    On Mon, 22 Feb 1999, Oleg Broytmann wrote:
    
    > Hello!
    > 
    >    I am trying to execute query:
    > SELECT city_id, COUNT(DISTINCT pos_id)
    >    ...
    > GROUP BY city_id ;
    > 
    >    but got the error:
    > ERROR:  parser: parse error at or near "distinct"
    > 
    >    It is me who do not understand SQL or postgres does not implement it?
    > 
    > Oleg.
    > ---- 
    >     Oleg Broytmann     http://members.xoom.com/phd2/     phd2@earthling.net
    >            Programmers don't die, they just GOSUB without RETURN.
    > 
    > 
    > 
    
    
    
  3. Re: [HACKERS] SELECT COUNT(DISTINCT)

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 1999-02-23T03:13:07Z

    >    I am trying to execute query:
    > SELECT city_id, COUNT(DISTINCT pos_id)
    >    ...
    > GROUP BY city_id ;
    > It is me who do not understand SQL or postgres does not implement it?
    
    As Andy points out, it is not (yet) implemented. afaik no one is working
    on it currently.
    
                        - Tom