You can use the InnoDB table type which supports foreign keys.
http://www.mysql.com/doc/S/E/SEC446.html
If you want to use MyIsam table types, the only solution is to send a
specific request to delete records in both the tables.

Regards,
Bhavin.
----- Original Message -----
From: "multivac" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 2:22 PM
Subject: How to On DELETE CASCADE


> Hello,
>
> I'm quite new in MySQL and PHP, so I guess my question is stupide. Sorry
> for that but I really need the solution...
>
> I have 2 tables
>
> table Client :
> -----------------------
> |ClientID | ClientName|
> -----------------------
> |    1    | Eric      |
> |    2    | Mark      |
> |    3    | Simon     |
> -----------------------
>
> and table Command :
> -------------------------------
> | CommandID | ClentID | Price |
> -------------------------------
> |     2     |    1    |   32  |
> |     1     |    1    |   12  |
> |     3     |    2    |   38  |
> |     4     |    2    |   65  |
> |     5     |    3    |   81  |
> -------------------------------
>
> The primary Keys are ClientID on table Client and CommandID on table
> Command.
>
> I'm looking for a way to be sure that when deleting an entry in Client
> table, all the corresponding entries in Command table are deleted
> without sending a specific request for that.
>
> It seems that in SQL a froreign key is the solution but the MySQL
> documentation says that foreign keys aren't implemented in MySQL, so how
> to solve this elementary issue ?
>
> Thank you in advance for your replies or suggestions,
>
> @+
>
> Carl
>
> ---------------------------------------------------------------------
> 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