Re: Query help pls

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Apr 21 2004 - 23:06:54 EDT

  • Next message: Michele Cuozzo: "SERIAL fields"

    You can do this with "db:" expressions that include database
    relationships and attributes per "String Expression Tips"
    (http://objectstyle.org/cayenne/userguide/expressions/common.html).
    E.g. you can do something like this:

    "toOrg = $org and db:id <> db:toOrg.boss_id"

    ..this is assuming that both ObjRelationship and DbRelationship are
    called "toOrg".

    Andrus

    On Apr 21, 2004, at 7:08 PM, Steve Wells wrote:
    > Hi,
    >
    > What is the best way to do this without using a SqlSelectQuery...
    >
    > Say I have Organsiation (Org) and Employee tables. The Org has a
    > boss_id
    > column that of course points to an employee.id, and employee.org_id
    > points to Org.id
    >
    > I want to display the list of employees for an org *excluding* the
    > boss.
    > Easy in SQL, but I can't figure it using Expressions. It seems you
    > can't
    > add PK columns in Expressions nor can i see how u say emp.id <>
    > org.boss_id. Something to do with joinExp(...) i guess?
    >
    >
    > Using 1.1 M5.
    >
    > Thanks,
    >
    > Steve



    This archive was generated by hypermail 2.0.0 : Wed Apr 21 2004 - 23:07:02 EDT