在codeigniter中INNER JOIN ON条件

时间:2017-01-27 08:20:47

标签: php mysql codeigniter

这是我的mysql查询

SELECT MAX(A.BID),B.* 
  FROM tbl_bid A 
 INNER 
  JOIN wl_customers B 
    ON A.customers_id=B.customers_id
 WHERE portfolio_id='$Id'

如何在codeigniter中编写此查询。

3 个答案:

答案 0 :(得分:1)

你也可以试试。这也可以是其中一种方式

     $this->db->select('MAX(A.BID),wl_customers.*');
     $this->db->from('tbl_bid');
     $this->db->join('wl_customers ','tbl_bid.customers_id=wl_customers.customers_id');
     $this->db->where('portfolio_id',$Id,false)
     $result = $this->db->get();

答案 1 :(得分:0)

这样的东西
$this->db->select('MAX(A.BID),B.*')
->join('wl_customers as B','A.customers_id=B.customers_id')
->where('portfolio_id',$Id)
->get('tbl_bid as A')
->row();

答案 2 :(得分:0)

尝试使用此查询。它可能对您有所帮助:

var change = function (b, a) {
.....
.....
}, wall = {
loginOverrides: {
    "^(www\\.)?twitter\\.com": {
        action: function () {
        .....
        .....
        }