AW: retrieving double (or more) entries

From: Michael Schuldt (m..scensys.de)
Date: Mon Sep 13 2004 - 02:13:57 EDT

  • Next message: Lindsay Steele: "RE: Query on a Single Primary Key`"

    Hi Andrus,

    I'm working on MSSQL and found a similar solution with group by and count().
    I'm using this in a SQLSelectQuery and everything works fine.

    Thanks again for your answer

    Michael

    > -----Ursprungliche Nachricht-----
    > Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Gesendet: Montag, 13. September 2004 04:10
    > An: cayenne-use..bjectstyle.org
    > Betreff: Re: 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 : Mon Sep 13 2004 - 02:14:43 EDT