如何使用mysql从两个表中删除记录

问题描述:

我有两个表USER_INFO和USERS。它分别包含userid和id。我想在userid和id匹配时删除完整记录。

假设在USER_INFO表中userid = 125,在USERS表中id = 125;

我应该用什么查询删除整行。



我尝试过:



$ tables = array('USER_INFO','USERS');

$ this-> db-> where('id''userid','125');

$ this-> db-> delete($ tables);











DEL USER_INFO,来自USER_INFO的用户INNER JOIN USERS,其中USER_INFO.userid = USERS.id = 125

I have two tables USER_INFO and USERS. It contains userid and id respectively. I want to delete complete record when userid and id get match.
suppose in USER_INFO table userid =125, and in USERS table id=125;
what query should i use to delete complete row.

What I have tried:

$tables = array('USER_INFO ', 'USERS');
$this->db->where('id''userid', '125');
$this->db->delete($tables);



or

DELETE USER_INFO, USERS FROM USER_INFO INNER JOIN USERS WHERE USER_INFO.userid = USERS.id =125

tables = array('USER_INFO','USERS');
tables = array('USER_INFO ', 'USERS');


this-> db-> where('id''userid','125');
this->db->where('id''userid', '125');


this-> db-> delete(
this->db->delete(