a guest Jun 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- SELECT COUNT(tr.ticketnum) AS 'Product tickets by Rep', tp.prodcode, tr.repid, (COUNT(tp2.compprodtick)/COUNT(tp.prodcode)) AS 'Percent'
- FROM TicketRep AS tr
- JOIN TicketProduct AS tp
- ON tr.ticketnum = tp.ticketnum
- (SELECT prodcode, COUNT(prodcode) AS 'compprodtick'
- FROM TicketProduct
- GROUP BY prodcode) AS tp2
- ON tp.prodcode = tp2.prodcode
- GROUP BY tp.prodcode, tr.repid;
RAW Paste Data