You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Christopher Lenz <cm...@gmx.de> on 2002/08/08 15:09:42 UTC
New J2EE stores: subselects
Hi Ashok and all...
I've been wondering about the sub-selects you're using for the new database
schema. As far as I can tell, they're used to join between various tables and
the URI table.
For example this:
SELECT URI_STRING
FROM URI
WHERE URI_ID IN (
SELECT CHILD_URI_ID
FROM CHILDREN
WHERE URI_ID = 1
);
should result in this:
URI_STRING
------------
/actions
/files
/users
If the root URI "/" has ID 1 and the only children are "/actions", "/files" and
"/users". Right ?
Now, as sub-selects are not available for so popular MySQL, I've been trying to
figure out how to avoid them. As I noted, the sub-selects are used for joins, so
why not use actual joins instead, like this:
SELECT URI_STRING
FROM URI, CHILDREN
WHERE URI.URI_ID = CHILDREN.CHILD_URI_ID
AND CHILDREN.URI_ID = 1
?
Should have the same result, and should be more obvious to the database system's
query analyzer.
Or am I missing something ?
--
Christopher Lenz
_______________________________________________
/=/ cmlenz at gmx.de
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>