Subquery (not exists) problem (?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gamb?

    #1

    Subquery (not exists) problem (?)

    Hello!

    I've got some sort of syntax problem that doesn't seem to make a lot
    of sense. I'm developing a Categories Theory application and because
    of that I need to make big, and by "big" I mean HORRIBLY HUGE queries.
    That one has 54 lines and 3 subqueries (only the first one is shown so
    that I won't scare people off :)).

    The thing is, I don't seem to be getting the hang of how to do
    subqueries. The syntax seems fine... But it'll still always say the
    same thing:

    You have an error in your SQL syntax. Check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near 'exists ( select * from objeto c, morfismo f1, morfismo f2
    (It's MySQL 4.0.11a-gamma)

    The only difference I see between the code below and the mysql.com
    documentation is that my subqueries aren't alone in their "where"
    clauses... Aside from that, they seem pretty much okay. Am I missing
    something?

    10 · · select o.obj_nome obj, p1.mor_nome pi1, p2.mor_nome pi2
    11 · · from objeto o, morfismo p1, morfismo p2
    12 · · where
    13 · · · o.cat_nome = '$scat' and p1.cat_nome = '$scat' and
    p2.cat_nome = '$scat' and
    14 · · · p1.obj_dest = '$sa' and
    15 · · · p2.obj_dest = '$sb' and
    16 · · · p1.obj_orig = o.obj_nome and
    17 · · · p2.obj_orig = o.obj_nome and
    18 · · · not exists ( select *
    19 · · · · from objeto c, morfismo f1, morfismo f2
    20 · · · · where
    21 · · · · · c.cat_nome = '$scat' and f1.cat_nome = '$scat'
    and f2.cat_nome = '$scat' and
    ·· · · · · · -- (... blah blah blah ...)
    63 · · · )

    Thank you in advance!

    :: =EG= ::
Working...