You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by je...@optonline.net on 2004/03/09 08:06:57 UTC

Still no luck with this query

Dear all,

Maybe I wasn't asking my question well because it had not gained a response in about a week.  Maybe I am missing something very simple, but I am still pretty new to any kinda OR-mappings and I have nobody who can help but this list.  Rather then try to explain the 4 different ways I tried to solve it again, how might people with better understanding.   I can not find an answer to this in the mailing lists nor in the docs.  If you have a reference, please give me a pointer.

I am trying to get a listing of all of the services ('aservice') that are interested in my particular service (having id 101).

// The query I would like agressively abreviated:
SELECT r.msid, r.rtitle, r.brief
FROM aservice r, serviceinterest si
WHERE ((si.targetmsid = 101)
      AND (si.interestmsid = r.msid))


// I want a collection of these returned
CREATE TABLE aservice (
  msid BIGINT(20) NOT NULL,
  rtitle VARCHAR(70) NOT NULL,
  brief VARCHAR(255) NULL,
  PRIMARY KEY(msid),
)


// Note a duo key that should not be referenced in whole by aservice:
CREATE TABLE serviceinterest (
  targetmsid BIGINT(20) UNSIGNED NOT NULL,
  interestmsid BIGINT(20) UNSIGNED NOT NULL,
  PRIMARY KEY(targetmsid, interestmsid)
)


I have been having problems because of foreign keys and how INNER JOIN seems to work with this query.


Thank you if you can.  I will gladly post more detailed information or email the code as need be.

JohnE
jeichels@hotmail.com





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Still no luck with this query

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi john,

you should at least provide some information about the repository you use.

jakob

jeichels@optonline.net wrote:

> Dear all,
> 
> Maybe I wasn't asking my question well because it had not gained a response in about a week.  Maybe I am missing something very simple, but I am still pretty new to any kinda OR-mappings and I have nobody who can help but this list.  Rather then try to explain the 4 different ways I tried to solve it again, how might people with better understanding.   I can not find an answer to this in the mailing lists nor in the docs.  If you have a reference, please give me a pointer.
> 
> I am trying to get a listing of all of the services ('aservice') that are interested in my particular service (having id 101).
> 
> // The query I would like agressively abreviated:
> SELECT r.msid, r.rtitle, r.brief
> FROM aservice r, serviceinterest si
> WHERE ((si.targetmsid = 101)
>       AND (si.interestmsid = r.msid))
> 
> 
> // I want a collection of these returned
> CREATE TABLE aservice (
>   msid BIGINT(20) NOT NULL,
>   rtitle VARCHAR(70) NOT NULL,
>   brief VARCHAR(255) NULL,
>   PRIMARY KEY(msid),
> )
> 
> 
> // Note a duo key that should not be referenced in whole by aservice:
> CREATE TABLE serviceinterest (
>   targetmsid BIGINT(20) UNSIGNED NOT NULL,
>   interestmsid BIGINT(20) UNSIGNED NOT NULL,
>   PRIMARY KEY(targetmsid, interestmsid)
> )
> 
> 
> I have been having problems because of foreign keys and how INNER JOIN seems to work with this query.
> 
> 
> Thank you if you can.  I will gladly post more detailed information or email the code as need be.
> 
> JohnE
> jeichels@hotmail.com
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org