--- query to find records related tables with no match?

2001-12-30 Thread MySQL baby

Ack - sorry - can someone remind me the SQL format for this?

if you have a linked CLIENTS and INVOICES table...

...what's the query to find CLIENTS with NO INVOICES?

(say 'clientid' is the name of the field in both clients and invoices table)

I think it's some kind of join=NULL but I'm stuck.



Thanks!


-
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




Re: --- query to find records related tables with no match?

2001-12-30 Thread David J Jackson

From page 165 MySQL (New Riders):
LEFT JOIN:
SELECT t1.* FROM t1 LEFT JOIN t2
ON t1.i1 = t2.i2 
WHERE t2.i2 IS NULL

-- david



 Ack - sorry - can someone remind me the SQL format for this?
 
 if you have a linked CLIENTS and INVOICES table...
 
 ...what's the query to find CLIENTS with NO INVOICES?
 
 (say 'clientid' is the name of the field in both clients and invoices
 table)
 
 I think it's some kind of join=NULL but I'm stuck.
 
 
 
 Thanks!
 
 
 -
 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