Richard,

Tuesday, December 31, 2002, 4:12:15 PM, you wrote:
> Hi folks,

> I hope that dumb questions are allowed in here ...

> I have two MySQL tables and I would like to delete records from one
> based on associated values in another.  For example, using the example
> tables below, how would I delete all the records in the TIDS table that
> had an associative value of 'Air Force' in the TID_ADMIN table?


> TID_ADMIN
> --------------------
>  ID (pk)   |  Service
> --------------------

> 1             Army
> 2             Navy
> 3             Air Force
 

> TIDS
> --------------------------------------
> ID   |   ADMIN_ID       |   Project Name
> --------------------------------------

> 1           1               Project X
> 2           1               Project Y
> 3           2               Vision C
> 4           3               Clearout T
> 5           3               Clearout F
> 6           3               Trustee 433

> I have tried, to no avail, using variants of ...

> DELETE FROM  tids, tid_admin
> WHERE        tid_admin.admin_id = tids.admin_id
> AND          tid_admin.service = 'Air Force'

> Can someone point me in the right direction.  I'm still feeling my way
> through all this.


> Rik Forgo
> JIST3
> Army Test, Training and Technology Integration Office (T3I)
> Diverse Technologies Corp.
> (c) 443.463.8571
> (h) 410.859.8474




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


Now i don't use the multitable deletes much .. at least not yet

but i think

DELETE tids FROM  tids, tid_admin
WHERE        tids.admin_id = tid_admin.id
AND          tid_admin.service = 'Air Force'

should delete the rows from tids you wanted

--
 Brian Lindner




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