Re: retrieving double (or more) entries

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Sep 12 2004 - 22:09:48 EDT

  • Next message: Michael Schuldt: "AW: retrieving double (or more) entries"

    On Sep 12, 2004, at 8:33 AM, Michael Schuldt wrote:
    > I've got a table with articles. There can be duplicate
    > article-numbers. How
    > can I get a list of all articles, that are more than once present in
    > the
    > database?
    >
    > Thanks in advance
    >
    > Michael

    Hi Michael,

    You can do this with SQLTemplate mapped to article class. SQL is
    db-dependent (and not all DB support subqueries and "group by"). Here
    is something I know works on Oracle:

    select column1, column2, ... from article
    where article_number in
    (select article_number from article
      group by article_number
      having count(1) > 1)

    Andrus



    This archive was generated by hypermail 2.0.0 : Sun Sep 12 2004 - 22:09:53 EDT