I'm trying to add a SQL Sum to display the total number of IN_QTY and the total number loaded. Example: In the screenshot, I have 200 for IN_QTY, and based on LOGIN_DTTM I have 75 loaded.
I would like to have it displayed like this 200/75.
Can someone help with this request? It's my first time using Stack overflow.
My Query:
Select a.lot, a.lpt, a.opn, a.in_Qty, a.device, a.arrival_Dttm, a.login_dttm, a.priority, a.location
From
(Select lma.lot, lma.lpt, lma.opn, lma.device, lma.in_qty, arrival_dttm, login_dttm, lco.equip_grp, ls.priority, ls.lot_code3 as location
From lot_cur_opn lco, lot_move_age lma, dm_device_attributes dda, lot_str ls
where lco.facility = lma.facility
and dda.facility = lma.facility
and lma.facility = ls.facility
and dda.device = lma.device
and lco.lot = lma.lot
and lma.lot = ls.lot
and lma.facility = 'DP1DM5'
and lco.opn in ('4927') --specify query operation
and lma.departure_dttm is null
and lma.latest = 'O'
and ls.latest = 'Y'
and dda.family not like '%PILOT%'
and dda.family not like '%NONE%'
and dda.family not like '%ENG%'
and dda.family not like '%LBQ%'
) a
Join
(Select equip_grp, substr(trk_id,0,3)
From equip_grp_trk_lst egl
where egl.stop_dttm is null
and egl.status = 'A'
and egl.trk_id like 'SE2%' --specify equipment type
and egl.trk_id not like '%LOGTHR%'
group by equip_grp, substr(trk_id,0,3)) b
On b.equip_grp = a.equip_grp
order by priority, arrival_dttm
Screenshot: Current Output