我正在研究Codeigniter中的查詢,我試圖保持它看起來乾淨。我甚至還沒有添加大部分字段,我可以看到它變得笨拙,特別是select_sum的。Codeigniter查詢鏈接
有沒有寫他們還是有辦法把它們混合起來的更清潔的方式?
$this->db->select('Map');
$this->db->select_sum('Kills')->select_sum('Deaths')->select_sum('Win')->select_sum('Loss')->select_sum('Win + Loss', 'GP');
$this->db->from('games');
$this->db->where('Name', $player_name);
$this->db->join('players', 'players.PlayerID = games.PlayerID');
$this->db->join('gameinfo', 'games.GameID = gameinfo.GameID');
$this->db->group_by('Map');
$this->db->order_by('Kills', "desc");
$this->db->limit(10);
$query = $this->db->get();
return $query->result_array();
看上去幹淨給我! – 2012-02-24 02:46:29