mysql - Delete from 'table2' where column = 'value' IF column in 'table1' = 'value' -


i trying execute mysql query delete rows 'table2' column = 'value' if column in 'table1' = 'value'

i have 2 tables...

table 1 called 'accounts'
table 2 called 'inventoryitems'

the column in question 'accounts' called 'banned'
column in question 'inventoryitems' called 'itemid'

i delete inventoryitems itemid = 2340000 if... column banned in accounts has value of 1

extra information:

you can join table accounts inventoryitems 3rd table called characters.

table accounts has columns: id (primary key) , banned.

table characters has columns: characterid , accountid (accountid links id in table accounts).

table inventoryitems has columns itemid , characterid (characterid links characterid in table characters)

hope helps.

delete inventoryitems characterid in (select id characters accountid in (select id accounts banned = '1' ) ) , itemid = '2340000';


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -