In MySQL 4.0.x:

DELETE order_details FROM order_details LEFT OUTER JOIN order_header ON
(order_details.order_number = order_header.order_number) WHERE
order_header.order_number IS NULL;

-JF
> -----Original Message-----
> From: Gurhan Ozen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 20, 2002 11:35 AM
> To: Darley, Terry; [EMAIL PROTECTED]
> Subject: Re: Sub-selects
>
>
> Take a look at:
>
> http://www.mysql.com/doc/T/O/TODO.html  and
> http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html
>
> You can do what you want to do easily by using an API (PHP, Perl, etc.) Is
> it possible for you to use an external program, or does it have to be SQL
> only?
> Gurhan
>
> ----- Original Message -----
> From: "Darley, Terry" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, June 20, 2002 10:29 AM
> Subject: Sub-selects
>
>
> > To Whom It May Concern:
> >
> > I've just joined the mailing list for problem sharing/helping and the
> first
> > 2 e-mails I received, demonstrates a need for sub-selects in MySQL. Is
> there
> > any plan to write this into future releases of MySQL ? If so,
> when do you
> > anticipate this will be released ?
> >
> > In the absence of sub-selects how would you solve the problem below ?
> >
> > DELETE FROM order_details
> > WHERE order_number NOT IN
> > (SELECT order_number FROM order_header);
> >
> > ... remove all order details where there isn't a record in the order
> header
> > !
> >
> > Much obliged in anticipation.
> >
> > Regards,
> >
> > Terry
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>


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