有二个表(本应该是一个表,上一个程序员把,内容信息单独存一个表,我也不知道为啥一对一的结构,要在二个表里),二个表中ID相同的是一条记录。表A
app_id
app_name
app_type
app_url
app_time
app_tag
arr_link_type
表B
app_id
app_content它们的字段如上表,当要取一条数据时,以ID相联,取出数据来。现在我要以写一条删除语句,以 arr_link_type=1为删除条件。
怎么样才能在A表里删除了数据后,把B表对应的数据都删了。
app_id
app_name
app_type
app_url
app_time
app_tag
arr_link_type
表B
app_id
app_content它们的字段如上表,当要取一条数据时,以ID相联,取出数据来。现在我要以写一条删除语句,以 arr_link_type=1为删除条件。
怎么样才能在A表里删除了数据后,把B表对应的数据都删了。
DELETE FROM dx_app_info as A,dx_app_content as B WHERE A.app_id =B.app_id and A.arr_link_type=1
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as A,dx_app_content as B WHERE A.app_id =B.app_id and A.arr_link_type=1' at line 1
delete from A where arr_link_type=1