You can use JOIN...

See: http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html

Gurhan

-----Original Message-----
From: van den Heuvel, Frank [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 8:47 AM
To: '[EMAIL PROTECTED]'
Subject: select in select


Hello,

I would like to do this witihn mysql:

SELECT con.id,con.name FROM contacts con, registrar_contact reg
WHERE NOT con.id IN
(SELECT contactid FROM registrar_contact WHERE registrarid=1)

can someone tell me how to do this ?

contacts table consists of:
id(primary key)
name

registrar_contact consists of:
registrarid
contactid(this is linked to contacts id field)
(there is no primary key)


thanks in advance.

Regards,

Frank


---------------------------------------------------------------------
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


---------------------------------------------------------------------
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