I'm using CodeIgniter to access my Mysql database and I have two tables (News and Events) with the column ID. I figured I could use a select before (also tried after) using the 'as' keyword to return the News ID column as NewsID but it returns the NewsID and overwrites the ID colu开发者_如何学Cmn still. Below is some code to show an example.
$this->db->join('News', 'News.ID = Events.NID', 'left');
$this->db->where('Events.ID', $ID);
$this->db->get('Events');
//tried this before and after the join and added to the condition
$this->db->select('*, News.ID as NewsID');
Any Information or ideas would be extremely helpful.
Try using
select('Events.*, News.ID as NewsID')
精彩评论