• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
JOIN whit active record, 3 tables + pagination..

#1
[eluser]tnathos[/eluser]
HI.. how i can make this query whit Active record.. and i need put tha pagination..


Code:
select a.titulo, b.marca, sum(c.puntos) as puntos
from
table1 a,
table2 b,
table3 c
where
a.marca=b.id and
a.id_proceso=c.id_proceso and
a.estado =1
group by
a.titulo, b.marca
order by puntos DESC
LIMIT 10, 5

#2
[eluser]tnathos[/eluser]
any!?

#3
[eluser]flaky[/eluser]
Read the user guide

Code:
$this->db->select('a.titulo, b.marca, SUM(c.puntos)');
$this->db->from('table1 AS a');
$this->db->join('table2 AS b', 'a.marca = b.id');
$this->db->join('table AS c', 'a.id_proceso = c.id_proceso');
$this->db->where('a.estado', '1');
$this->db->group_by('a.titulo, b.marca');
$this->db->order_by('puntos');
$this->db->limit(10, 5);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.