this is my mysql query
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'
how to write this query in codeigniter.
You can also try. This can also be one of the way
$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();
Something like
$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();
Try with this query. It may be helpful for you :
$this->db->select("B.*","MAX(A.BID)")
->from("tbl_bid A")
->join("wl_customers B","A.customers_id=B.customers_id")
->where("portfolio_id",$Id)->get()->result();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.