im trying to make like
id name qty
1 item a 3
2 item b 9
3 item c 7
from
id name qty
1 item a 1
1 item a 2
2 item b 3
2 item b 1
2 item b 5
3 item c 3
3 item c 4
by using codes like this
$recapout = DB::table('tb_itemsout')
->select(DB::raw('sum(tb_itemsout.qty) as qty'),'tb_itemsout.id','tb_master_item.item_name','tb_itemsout.qty')
->groupBy('tb_itemsout.','tb_master_item.item_name','tb_itemsout.qty')
->join('tb_master_item','tb_itemsout.id','tb_master_item.id')
->orderBy('tb_master_item.id_item','DESC')
->get();
but it doesnt seem to work. it keeps shows up like
this
id name qty
1 item a 1
1 item a 2
2 item b 3
2 item b 1
2 item b 5
3 item c 3
3 item c 4
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SvEtkF
via IFTTT
Aucun commentaire:
Enregistrer un commentaire