I need a report that will show me how many referrals have been made and to whom. Does anyone have something like that??
Thanks! Tara
I just emailed you one to see if that would work for you or close to what you need. Thx. Jen
you can run this script:
SELECT (SELECT CASE WHEN RTRIM(LTRIM(RTRIM(ISNULL(PROVLASTNAME, '')) + ', ' + RTRIM(ISNULL(PROVFIRSTNAME,'')))) = ',' THEN '' ELSE RTRIM(ISNULL(PROVLASTNAME, '')) + ', ' + RTRIM(ISNULL(PROVFIRSTNAME,'')) END + ' (' + LISTNAME + ') ' AS REFER_TO
FROM dbo.SERVPROV RIGHT OUTER JOIN
dbo.SERVPROVORG ON dbo.SERVPROV.BUSID = dbo.SERVPROVORG.SERVPROVORGID
WHERE dbo.SERVPROV.SERVPROVID = ORDERS.SERVPROVID) AS REFER_TO, COUNT(*) AS TOTAL_REFERRALS
FROM ORDERS
WHERE ORDERTYPE = 'R' AND XID = 1000000000000000000 AND STATUS NOT IN ('X') AND ORDERS.ORDERDATE BETWEEN '1/1/2015' AND '12/31/2015'
GROUP BY ORDERS.SERVPROVID
Change the dates as needed
I'm interested in this too. Thanks!
This looks interesting... we are using 9.8.11 - I can't find the SERVPROVORG dbo... is it hiding somewhere?