but before you issue this command and possibly trash your database, use
         select * from a_table where status='flag_value';
to look at the records which will be deleted. you may find some surprises.



At 08:19 AM 7/16/01 -0400, you wrote:
>Why not:
>
>delete from a_table where status='flag_value';
>
>Please read the manual, this is one of the most basic operations you
>can do, and is obvious the minute you look at
>
>http://www.mysql.com/doc
>
>
>---------- Original Message ----------------------------------
>From: "rob anderson" <[EMAIL PROTECTED]>
>Date: Mon, 16 Jul 2001 13:14:20 +0100
>
> >I am trying to delete records from a table, where the 'id' to be
>deleted >should only happen if a certain flag (status) exists.
> >
> >The table contains one or more records for the same id, only the flag
> >changes.
> >
> >I have tried
> >
> >
> >create temporary table temp (id int not null);
> >
> >select id from tracking where tracking.status = 5;
> >
> >delete from tracking
> >    where id = select temp.id from temp;
> >
> >drop table temp;
> >
> >
> >
> >But this fails.
> >
> >
> >
> >
> >I am not a SQL guru, and would appreciate any help
> >
> >
> >Rob
> >
> >
>
>
>--
>                \\|//
>                (@ @)
>    -------oOO---(_)---OOo------------
>    |                                |
>    | Mike Baranski                  |
>    | Security Managment Consulting  |
>    | http://www.secmgmt.com         |
>    |                                |
>    |                                |
>    ----------------------------------
>               |__|__|
>                || ||
>               ooO Ooo
>--
>
>
>---------------------------------------------------------------------
>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


----------
tom marlin
[EMAIL PROTECTED]
fax / voice mail: 714 507 3802 ext 4881
Never be afraid to try something new. Remember that
   - amateurs built the ark.
   - professionals built the Titanic.

Reply via email to