我试图执行查询,从表1中得到的数据和应用,其中上表2 这一条款是一个示例查询上的代码点火器获取两个表中的数据
SELECT * FROM table1,table2 WHERE `hide` = 0 AND `reject` = 0 AND `disable` = 0 AND `private` = 0 AND `table2`.`wepay_account_id` != '' ORDER BY `table1_id` DESC LIMIT 40
此查询执行执行在数据库中,但在代码点火器不执行
我试图将此代码模型
$this->db->limit($limit, $start);
$this->db->where('hide', 0);
$this->db->where('reject', 0);
$this->db->where('disable', 0);
$this->db->where('private', 0);
$this->db->where('table2.wepay_account_id !=',"");
$this->db->from('table1','table2');
$this->db->order_by('table1', 'DESC');
$query = $this->db->get();
$a=$this->db->last_query();
print_r($a);
exit;
但我面对这个错误
Error Number: 1054
Unknown column 'table2.wepay_account_id' in 'where clause'
SELECT * FROM (`table1`) WHERE `hide` = 0 AND `reject` = 0 AND `disable` = 0 AND `private` = 0 AND `table2`.`wepay_account_id` != '' ORDER BY `table1_id` DESC LIMIT 40
Plz,给我们两张表的模式。 – Sharif
secema不是问题.... $ this-> db-> from('table1','table2');当查询执行table2不显示..看起来错误SELECT * FROM('table1').. table2丢失 –
其中是select语句?我的意思是''$ this-> db-> select('table1.SOMETHING,table2.SOMETHING');'' – Sharif