0 Replies Latest reply on Jan 30, 2003 4:53 AM by Chris

    ejb ql subselect or join

    Chris Newbie

      Hi,

      I have a 3 way relation between Function entity and Staff in the form of Manager, Deputy1 and Deputy2.
      How can I query to find someone who is in either of these 3 relations?

      I can do:
      SELECT Object(o) FROM Staff IN (o.fManager), IN (o.fDeputy1), IN (o.fDeputy2)
      but this does an 'AND' clause so you would have to be both a manager and a deputy 1 & 2 to get any results back!!

      Is it possible to do either
      a) an 'OR' clause for this case relating to the 'IN' part
      b) somehow do a join on 3 separate queries
      c) a subquery/subselect
      I tried already something like
      SELECT Object(o) FROM Staff WHERE o.staffId IN (SELECT s.staffId FROM Staff s WHERE ...etc) but unlike WebLogic it seems that JBoss cannot do subqueries?

      Thanks

      Chris
      =--=-