Welcome Guest, Not a member yet? Register   Sign In
Need Help for sum statement
#4

[eluser]Farzand[/eluser]
Thanks alot dear i got my mistake so can tell more one thing i want sum 2 field of both tables so should i need to do?

$this->db->select("bt_tayyab_lc.id as id1, sum(bt_tayyab_lc.weight) as weight,
bt_tayyab_remarks.id as id2,
sum(bt_tayyab_remarks.remarks) as remarks,
bt_tayyab_remarks.lcid as lcid");
$this->db->join('tayyab_remarks','tayyab_lc.id = tayyab_remarks.lcid');
$this->db->where('tayyab_lc.creat_at >=', $currentdate1);
$this->db->where('tayyab_lc.creat_at <=', $currentdate);
$this->db->where('tayyab_lc.cid','1');
$this->db->group_by('bt_tayyab_lc.id', 'bt_tayyab_remarks.id','bt_tayyab_remarks.lcid'); // <----- here
$data['supplier_account'] = $this->db->get('tayyab_lc');


Messages In This Thread
Need Help for sum statement - by El Forum - 03-27-2012, 11:16 AM
Need Help for sum statement - by El Forum - 03-27-2012, 11:16 AM
Need Help for sum statement - by El Forum - 03-27-2012, 12:02 PM
Need Help for sum statement - by El Forum - 03-27-2012, 12:31 PM
Need Help for sum statement - by El Forum - 03-27-2012, 12:46 PM
Need Help for sum statement - by El Forum - 03-27-2012, 12:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB