Hi, 

I am trying to make a database-neutral application.
What is the MySQL idiom to replace the Postgres EXISTS function?

I have two tables:

 
mysql> select * from groupcapability;
+----+--------------+------------+
| id | melati_group | capability |
+----+--------------+------------+
|  0 |            0 |          0 |
+----+--------------+------------+
 
mysql> select * from groupmembership;
+----+------+--------------+
| id | user | melati_group |
+----+------+--------------+
|  0 |    1 |            0 |
+----+------+--------------+

In Postgres the following query works:

SELECT * FROM groupmembership WHERE "user"  =  1  AND 
EXISTS (
   SELECT groupcapability."melati_group" , capability 
     FROM groupcapability, groupmembership 
          WHERE 
           groupcapability."melati_group" = groupmembership."melati_group" 
           AND 
              capability = 0 );

How should this be written in MySQL?

(NB I have had to use melati_group instead of group due to MySQL objecting to 
the keyword group.)

tia
timp

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to