Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getInnerJoin(){
- return $this->find('columns: a.id, a.denominacion, (p.costo + (p.costo * p.ganancia / 100)) AS precio',
- 'join: a LEFT JOIN articulos.precio p on(a.id = p.articulo_id)',
- 'conditions: not exists (select 1 from articulos.precio p2 where p2.articulo_id = a.id and p2.fecha_at > p.fecha_at);');
- }
- public function buscar(){
- return $this->find_all_by_sql("SELECT a.id, a.denominacion, (p.costo + (p.costo * p.ganancia / 100)) AS precio
- FROM articulos.articulo a LEFT JOIN articulos.precio p on(a.id =p.articulo_id)
- WHERE not exists (select 1 from articulos.precio p2 where p2.articulo_id = a.id and p2.fecha_at > p.fecha_at);");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement