HomeFlySpeed SQL Queryquery multiple tables

query multiple tables

I want to delete records related to a specific user_id from multiple tables

I was coding by hand and trying

"DELETE FROM averages, averages_backup, comments, favorites, images, messages, ratings, ratings_backup, users, user_details, user_messages USING averages INNER JOIN averages_backup INNER JOIN comments INNER JOIN favorites INNER JOIN images INNER JOIN messages INNER JOIN ratings INNER JOIN ratings_backup INNER JOIN users INNER JOIN user_details INNER JOIN user_messages WHERE averages.user_id = $uid OR averages_backup.user_id = $uid OR comments.user_id = $uid OR favorites.user_id = $uid OR images.user_id = $uid OR messages.user_id = $uid OR ratings.user_id = $uid OR ratings_backup.user_id = $uid OR users.user_id = $uid OR user_details.user_id = $uid OR user_messages.user_id = $uid"

but now trying to use FlySpeed I don't see how to build a query for multiple tables

it's a rather large database so I was also trying separate queries:

$mq = mysql_query($setStmt);

$query1 = "DELETE FROM averages WHERE user_id = $uid";
$data1 = mysql_query($query1)
or die(mysql_error());

$query2 = "DELETE FROM averages_backup WHERE user_id = $uid";
$data2 = mysql_query($query2)
or die(mysql_error());

$query3 = "DELETE FROM favorites WHERE user_id = $uid";
$data3 = mysql_query($query3)
or die(mysql_error());

$query4 = "DELETE FROM images WHERE user_id = $uid";
$data4 = mysql_query($query4)
or die(mysql_error());

$query5 = "DELETE FROM messages WHERE user_id = $uid";
$data5 = mysql_query($query5)
or die(mysql_error());

$query6 = "DELETE FROM ratings WHERE user_id = $uid";
$data6 = mysql_query($query6)
or die(mysql_error());

$query7 = "DELETE FROM ratings_backup WHERE user_id = $uid";
$data7 = mysql_query($query7)
or die(mysql_error());

$query8 = "DELETE FROM users WHERE user_id = $uid";
$data8 = mysql_query($query8)
or die(mysql_error());

$query9 = "DELETE FROM user_details WHERE user_id = $uid";
$data9 = mysql_query($query9)
or die(mysql_error());

any suggestions?
rgoya | email
June 24 2008, 05:12 PM
ok I discovered you can add tables by right-clicking on them and selecting "add to query"

but maybe I'm missing something here...
rgoya | email
1 hour, 57 mins since original post
The FlySpeed SQL Query doesn't support building non-select queries visually. But you can write them manually, using a basic form of code completion in the SQL editor. Just type "delete from " and press <Ctrl>+<Space> and you will see a list of object names, available in the current database.
Sergey Smagin | email
11 hours, 29 mins since original post
This topic is closed