GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Jun-2004, 03:02
eRIC eRIC is offline
Junior Member
 
Join Date: Nov 2003
Location: Kyrgyzstan
Posts: 31
eRIC is on a distinguished road
Exclamation

DELETE all INFO from Different tables


Hi.
I have 7 tables.In all tables i have Id which is same for all tables.
i wan to delete rows which match with Id. how can i do?
for all delete queries (it will be 7) too much.
thanks.
__________________
Copyright by eRIC 2003 © !!!
  #2  
Old 01-Jun-2004, 06:19
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
I haven't done this for 7 tables but I have on occasion deleted from multiple tables successfully. try this and see if it works - also assume this is for 7 tables when I am showing just 3 ( yes, I am lazy to type the extra lines ):

PHP Code:

<?php

// the id/data you want to delete
$del_this_id    =  56;
$col            =  '`Id`';

$sql  =  "DELETE
           `t1`, `t2`, `t3`
         FROM
           `t1`, `t2`, `t3`
         WHERE
             `t1`.$col=`t2`.$col
         AND
             `t2`.$col=`t3`.$col
         AND
             `t3`.$col=$del_this_id";
mysql_query( $sql, $conn );
?>


Please note that this is untested! So your feedback will help others in a similar situation.
 

Recent GIDBlogThe bogus security of airport screening by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some exercises in C++, plus info on GUI programming. BlockAndBash CPP / C++ Forum 4 18-May-2004 20:07
changing default webpage info mkyb14 Apache Web Server Forum 2 12-Nov-2003 03:12
Selecting from 2 tables at the same time soviet MySQL / PHP Forum 2 07-Nov-2003 23:15
Can an SWF file gather info? rhino1616 Graphics Forum 3 31-Oct-2003 12:10
select & delete mysql queries skyloon MySQL / PHP Forum 1 22-Jul-2003 13:26

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:18.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.