Need Help With SQL Query »  Show posts from    to     

Icy Phoenix


Old Support Topics - Need Help With SQL Query



KugeLSichA [ Sat 07 Mar, 2009 16:08 ]
Post subject: Need Help With SQL Query
Hey guys,

i hope someone can help me with the following, and can provide a sql query for it... my mysql knowlegde is to low to do it on my own...

I need to delete all entries in TABLE_1 where topic_xxx from TABLE_2 is set to "0"... in both tables i have the topic_id field...

something like this, but this did not work:

Code: [Hide] [Select]
DELETE FROM `phpbb_table_1` WHERE `phpbb_table_2`.`topic_xxx` =0;


can someone help me with this?...

Thanks


Lopalong [ Mon 09 Mar, 2009 10:26 ]
Post subject: Re: Need Help With SQL Query
A bit difficult without seeing the actual script you want to change, but maybe this will help with what you are trying to drop.

ALTER TABLE phpbb_table_1 DROP topic_xxx;

That should drop the query sub-table, and don't forget to optimise the Db after you've applied it.


Mighty Gorgon [ Mon 09 Mar, 2009 16:22 ]
Post subject: Re: Need Help With SQL Query
Code: [Hide] [Select]
DELETE FROM `phpbb_table_1` WHERE `phpbb_table_1`.`topic_xxx` = `phpbb_table_2`.`topic_xxx`;


KugeLSichA [ Thu 12 Mar, 2009 23:02 ]
Post subject: Re: Need Help With SQL Query
hey guys,

many thanks for your help... but it didnt work...

so i have checked and study the mysql dev again, played a bit and now it works with the following (just for the people how are interested in)

Code: [Hide] [Select]
DELETE FROM phpbb_table_1
USING phpbb_table_1, phpbb_table_2
WHERE phpbb_table_2.topic_xxx = 0 AND phpbb_table_2.topic_id = phpbb_table_1.topic_id




Powered by Icy Phoenix